PyQt: How to hide QMainWindow

Make the first window a parent of the second window: class Dialog_02(QtGui.QMainWindow): def __init__(self, parent): super(Dialog_02, self).__init__(parent) # ensure this window gets garbage-collected when closed self.setAttribute(QtCore.Qt.WA_DeleteOnClose) … def closeAndReturn(self): self.close() self.parent().show() class Dialog_01(QtGui.QMainWindow): … def callAnotherQMainWindow(self): self.hide() self.dialog_02 = Dialog_02(self) self.dialog_02.show() If you want the same dialog to be shown each time, do something like: … Read more

PyQt: RuntimeError: wrapped C/C++ object has been deleted

This answer to this question is as found here: Python PySide (Internal c++ Object Already Deleted) Apparently, assigning one widget to QMainWindow using setCentralWidget and then assigning another widget with setCentralWidget will cause the underlying c++ QWidget to be deleted, even though I have an object that maintains reference to it. Note: QMainWindow takes ownership … Read more