PDA

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.

fezz
05-25-2012, 01:40 AM
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.

CGTalk Moderation
05-25-2012, 01:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.