Pyqt5 - Mainwindow opens and then closes

Asked

Viewed 69 times

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 loadWorkspace to load the 'Workspace' UI, it appears, but closes instantly?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.