Y
Y
yourisus2016-12-10 19:46:50
Qt
yourisus, 2016-12-10 19:46:50

How to change Widgets?

Created in main widget

app = QtGui.QApplication(sys.argv)
main_frame = MainFrame()
main_frame.show()
app.exec_()

in the mainframe widget i create another widget in the mainframe widget method but don't assign the parent - newWidget(parent = None) , i need the old mainframe widget to disappear and in the same window (or the old one closes and the new one appears) the new newwidget newWidget appears .
I tried to send a signal to a new widget through signals so that it * .show (),
I give the old command * .hide (). The result - the window just changes for a second and immediately closes

in class mainFrame
window = WindowTab(parent = None)
self.switch_choose_frm.connect(window.show_frame)
self.switch_choose_frm.emit()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2016-12-10
@khrisanfov

It looks like you're creating the widget statically, so it disappears when the MainFrame() constructor executes. It is necessary so
Signals are not needed here, you just need to call show: window->show();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question