Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23218

Pyside2 second window(QDialog) closes the main one

$
0
0
import sysfrom PySide2.QtCore import QFilefrom PySide2.QtWidgets import QApplication, QMainWindowfrom PySide2.QtUiTools import QUiLoaderclass MyMainWindow(QMainWindow):    def __init__(self):        super().__init__()        loader = QUiLoader()        self.ui = loader.load("mainWindow.ui", self)        self.ui.pushButton_call_dialog.clicked.connect(self.call_dialog)        self.ui.close()        self.ui.show()    def call_dialog(self):        loader = QUiLoader()        self.dialog = loader.load("dialog.ui")        self.dialog.show()if __name__ == '__main__':    app = QApplication(sys.argv)    window = MyMainWindow()    window.show    sys.exit(app.exec_())

Hi everyone,any idea why the second (dialog) window closes the entire application?Of course, it is not a crash since i'm getting a message saying:

Process finished with exit code 0

Thanks for your help


Viewing all articles
Browse latest Browse all 23218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>