I have a pyqt script displaying a widget with some buttons doing some stuffs.
I start it like this, which is the recommended way :
class Dialog(QtGui.QWidget):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
if __name__ == '__main__':
app = QtGui.QApplication.instance()
if not app:
print "new QApplication created"
app = QtGui.QApplication([])
window = Dialog()
the problem is that when hitting upper right cross button to exit the widget (closeEvent), it seems a lot of stuff stay in max memory.
for example if I do a qttimer which print some stuff every x seconds, once I close my window script, the timer still print stuff !!!
So, is there a way to totally exit, and if possible, deleting my Qapplication instance, so nothing stay in max memory, and next time I launch it it will create a new instance ?
I have a pyqt script displaying a widget with some buttons doing some stuffs.
I start it like this, which is the recommended way :
class Dialog(QtGui.QWidget):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
if __name__ == '__main__':
app = QtGui.QApplication.instance()
if not app:
print "new QApplication created"
app = QtGui.QApplication([])
window = Dialog()
the problem is that when hitting upper right cross button to exit the widget (closeEvent), it seems a lot of stuff stay in max memory.
for example if I do a qttimer which print some stuff every x seconds, once I close my window script, the timer still print stuff !!!
So, is there a way to totally exit, and if possible, deleting my Qapplication instance, so nothing stay in max memory, and next time I launch it it will create a new instance ?
Is there such problems with pyqt inside maya ?[/QUOTE]
There are various ways this could be done, simple way is to use make it a singleton. The deleteLater method is something you look for btw.