Close or hide window ? Which the best ?
Moved
Unsolved
Language Bindings
-
Hello,
I have a window when clicked on a button launches another window. I want to close the first window and to show only the second window.
I tried close and hide methods and they work both for me but I want to know which the best and what is the difference between the two methods.
Here is my code :class TRANUSInterfaceVariationDialog(QtGui.QDialog, FORM_CLASS): def __init__(self,project,parent=None): """Constructor.""" super(TRANUSInterfaceVariationDialog, self).__init__(parent) self.setupUi(self) self.launch_btn.clicked.connect(self.launch_TRANUS_variation) def launch_TRANUS_variation(self): dialog = launch_variation_dialog.LaunchVariationDialog(self.folder,self.base_scenario.code,self.tranus_binaries,parent=self) #self.close() self.hide() dialog.show() result = dialog.exec_()
-
Hi!
hide
keeps the window object in memory, so you can show it again later.close
destroys it. -
Hello @Wieland,
In my case, I am integrating my interface as a plugin in QGIS. So, when closing all the windows and launching from QGIS, the main window is displayed. I don't really know If I need to destroy in this case.
Thanks for your reply.