Switching from QDialog to another QDialog window
-
Hi,
You are creating event loops within event loops with your code.
If you want to implement some sort of wizard, then you should consider using QWizard, otherwise, you should rather consider the use of QStackedWidget to switch from one widget to another within your dialog.
-
@LT-K101 https://doc.qt.io/qt-5/qwizard.html has already example code. What exactly is not clear?
-
@LT-K101 Still not sure what the problem is.
Here is some Python example code: https://doc.qt.io/archives/qtforpython-5.12/PySide2/QtWidgets/QWizard.html
You create a QWizard instance, add pages to it and show it. -
@jsulm Thanks for your assistance, can I show you my code if you don't mind?
from PyQt5 import QtWidgets, QtCore from mainmenu import MainWindow if name == "main": import sys app = QtWidgets.QApplication(sys.argv) mainwindow = MainWindow() mainwindow.show() sys.exit(app.exec_())
from PyQt5 import QtCore, QtGui, QtWidgets from ManageEmployee import EmployeeWindow class MainWindow(QtWidgets.QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.Reg_Emp_Button.clicked.connect(self.manage_reg_Employees) def manage_reg_Employees(self): self.hide() self.employeeWindow = EmployeeWindow(self) self.employeeWindow.show()
class EmployeeWindow(QtWidgets.QMainWindow): def __init__(self, mainMenu): super(EmployeeWindow, self).__init__() self.mainMenu = mainMenu self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.Back_Button.clicked.connect(self.Back_To_MainMenu) def Back_To_MainMenu(self): self.hide() self.mainMenu.show()
-
@LT-K101 said in Switching from QDialog to another QDialog window:
can I show you my code if you don't mind?
Sure. But what exactly is the problem?
-
@jsulm From the code I have posted above, what I want to do is click a PushButton in the last QMainWindow(ManageEmployee.py) and a first QDialog page will show. Again when I click on a PushButton from the first QDialog it should show a second QDialog window. I do not know what code to put in the ManageEmployee.py script