class AbandonButton(QPushButton): def __init__(self, *args, **kwargs): super(AbandonButton, self).__init__(*args, **kwargs) # Button settings self.setText('Vzdát se') self.released.connect(self.showDialog) def showDialog(self): # Are you sure dialog if QMessageBox.Yes == QMessageBox.question(self, 'Vzdát se', 'Opravdu se chcete vzdát?'): # Show menu from menu_window import MenuWindow self.cams = MenuWindow() self.cams.show() # Close this game window self.window().close()
import sys from PyQt5.QtWidgets import QApplication from menu_window import MenuWindow from game_window import GameWindow if __name__ == '__main__': app = QApplication([]) menu_window = MenuWindow() game_window = GameWindow() menu_window.show_game_signal = game_window.show_game_signal menu_window.show() sys.exit(app.exec_())