I write a program with a graphical interface through PyQT. Each class is implemented as a window (QtGui.QWidget). There is a main menu and from it other windows are caused. It is implemented, in general, for the following scheme:
import sys from PyQt4 import QtGui, QtCore class A(QtGui.QWidget): def __init__(self): super().__init__() self.button = QtGui.QPushButton("Push", self) def __call__(self): # дизайн елементов buttonsLayout = QtGui.QHBoxLayout() buttonsLayout.addWidget(self.button) buttonsGroupBox = QtGui.QGroupBox("Control buttons") buttonsGroupBox.setLayout(buttonsLayout) mainLayout = QtGui.QVBoxLayout() mainLayout.addWidget(buttonsGroupBox) self.setLayout(mainLayout) self.resize(200,200) self.show() class Main(A): def __init__(self): super().__init__() self.button.clicked.connect(A()) self.button.setGeometry(60,60,60,60) self.resize(200,200) if __name__ == "__main__": app = QtGui.QApplication(sys.argv) menu = Main() menu.show() sys.exit(app.exec_()) The problem is that if, for example, class A () is called by a button from a menu for the first time, then its entire design is displayed correctly, but if you close it through the window control button (cross), then the next time you open it, all its elements disappear ( Only the names of the groupboxes remain. Perhaps there are some additional methods that allow you to set up a correct reusable call for GroupBoxes?