PyQt5 - MainWindow opens and closes soon

1

main.py (dialog)

if __name__ == '__main__':
    try:
        import sys
        from user_interface.ui.login import Ui_Dialog
        from PyQt5 import QtCore, QtGui, QtWidgets

        app = QtWidgets.QApplication(sys.argv)
        login_window = QtWidgets.QDialog()
        ui = Ui_Dialog(login_window)
        login_window.show()
        sys.exit(app.exec_())

    except Exception:
        pass

login.py (mainwindow)

def loadWorkspace(self):
        try:
            from user_interface.ui.workspace import Ui_MainWindow
            from PyQt5 import QtCore, QtGui, QtWidgets

            workspace_window = QtWidgets.QMainWindow()
            ui = Ui_MainWindow()
            ui.setupUi(workspace_window)
            workspace_window.show()

        except Exception:
            pass

Why when I run the loadWorkspace function to load the 'workspace' gui, it appears but closes instantly?

    
asked by anonymous 08.08.2017 / 14:38

0 answers