python - Communicate between two MainWindow() in Qt -
my app, in qt, consists in 2 different windows (but both inherited qtgui.qmainwindow), , wondering how communicate between them. moreover, using multiple qmainwindow approach?
connect signals , slots between 2 window classes when instantiate them.
if __name__ == '__main__': app = qtwidgets.qapplication(sys.argv) window1 = mymainwindow1() window1.show() window2 = mymainwindow2() window2.show() # connect signals communicate between windows window1.somesignal.connect(window2.someslot) window2.anothersignal.connect(window1.anotherslot) app.exec()
qmainwindow
designed used main application window; simplifies addition of common window features toolbars , menus. however, don't think there harm in having multiple instances.
you can use anyqwidget
:
window = qtwidgets.qwidget() # note no parent given window.show()
Comments
Post a Comment