import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton class MainWindow(QMainWindow): def __init__(self): super().__init__() button1 = QPushButton(self) button1.setText("Mehet") button1.move(50, 100) button1.clicked.connect(self.on_click_button1) self.setGeometry(100,100,320,200) self.show() def on_click_button1(self): self.setWindowTitle('egy') if __name__ == '__main__': app = QApplication(sys.argv) mainWindow = MainWindow() sys.exit(app.exec_())