import sys from PyQt5.QtCore import QSize from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication class MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("My App") button = QPushButton("Press Me!") self.setFixedSize(QSize(400, 300)) # Set the central widget of the window self.setCentralWidget(button) app = QApplication(sys.argv) window = MainWindow() window.show() app.exec_()