Thank you guys for your answers!
I solved this by adding two lines (for sure it works, but is it OK?:):
@# -- coding: utf-8 --
from PyQt4 import QtCore, QtGui
from start_window import Ui_Form
from second_window import Ui_Form as Ui_Form_Second
class StartForm(QtGui.QWidget):
def init(self, parent=None):
QtGui.QWidget.init(self, parent)
self.ui = Ui_Form()
self.ui.setupUi(self)
self.child_windows = None # this one
self.ui.pushButton.clicked.connect(self.button)
def button(self):
secondWindow = SecondForm()
secondWindow.show()
self.child_windows = secondWindow # this one
self.hide()
class SecondForm(QtGui.QWidget):
def init(self, parent=None):
QtGui.QWidget.init(self, parent)
self.ui = Ui_Form_Second()
self.ui.setupUi(self)
if name == "main":
app = QtGui.QApplication(sys.argv)
myapp = StartForm()
myapp.show()
sys.exit(app.exec_())@
I am just wondering if this approach doesn't leave any garbages in memory, like closed forms?
I ma not using QWizard because this is going to be something more than widget with "Next" and "Previous" buttons. Nor QStackedWidget since, at some point, I want to have more than one visible widget at a time.