how to run children UI in python PyQt5?

0

I have main ui, and want to run children ui on click in main ui. children:

class sessionGenerator(QtWidgets.QMainWindow, designTg.Ui_MainWindow2):

    def __init__(self):

        super().__init__()

        self.setupUi(self)

        self.showHelp.clicked.connect(self.showHelpFull)

        self.next_1.clicked.connect(self.nextOne)

        self.next_2.clicked.connect(self.nextTwo)

        self.next_3.clicked.connect(self.nextThree)

    # all another code

if I use

app2 = QtWidgets.QApplication(sys.argv)

window2 = sessionGenerator()

window2.show()

app2.exec_()

it appears on a second and throws 0xC0000005

just sessionGenerator runs great itself. But i can't figure out how to run it from another ui

python
user-interface
pyqt5
asked on Stack Overflow Aug 18, 2019 by Apepenkov • edited Aug 18, 2019 by Apepenkov

1 Answer

0

Do not create second main application. only

window2 = sessionGenerator()
window2.show()

This lines need to be before first app exec.

app.exec_()
answered on Stack Overflow Aug 18, 2019 by Grzegorz Bokota

User contributions licensed under CC BY-SA 3.0