View Full Version : mel style deleteUI with PyQt
jaydru 05-24-2012, 11:41 AM anyone know how to do this with pyqt,
if (`window -ex $window`)
deleteUI $window;
i assume i need to get a pointer to the window and use sip
to get a pyQt object then window.close() just not sure how
|
|
safakoner
05-24-2012, 09:22 PM
you can use sip.delete(YourWidgetInstance) method. I haven't use it to destroy QMainWindow though, assuming it would work since it is a widget too.
however I suggest you check bool QWidget::close () method.
I think the simplest way to replicate the mel behavior in PyQt is to call your window like this:
def createWindow():
global win
try:
win.close()
except:
pass
win = MyGUI()
win.show()
return win
If an instance of that window is currently running, it will close it before creating a new one.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.