I have a UI that was written to be used in-app as a sort of project browser. It works fine in Maya and Nuke. All was happy.
I have been asked to be able to run it stand alone. It seemed easy enough, and it works fine. Problem is, when the UI is closed, the python process that was created for it stays around. I initially didn’t notice it, but when Maya hung up on me for a random issue, I went to the windows task manager to kill it and saw about 20 python processes running. Not good.
I boiled the UI down to a simple example. I spent a few hours googling this and couldn’t find a result that works. Any guidance is greatly appreciated.
import sys
from PySide import QtGui, QtCore
import os
import subprocess
#==> MAIN GUI <==#
class myWindow(QtGui.QMainWindow):
def __init__(self, func='create',parent=QtGui.QApplication.activeWindow()):
super(myWindow, self).__init__(parent)
self.setWindowFlags(QtCore.Qt.Tool)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setFixedSize(500,500)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myWin = myWindow()
myWin.show()
sys.exit(app.exec_())
the tool windows dont act like normal ones. tools windows are supposes to be a part of a bigger app so they dont close down the parent process. If you still want the look of the tool window, you’ll need to override close() as panupat mentioned. If it doesn’t matter, remove the tool window flag
[QUOTE=TheMaxx;27553]the tool windows dont act like normal ones. tools windows are supposes to be a part of a bigger app so they dont close down the parent process. If you still want the look of the tool window, you’ll need to override close() as panupat mentioned. If it doesn’t matter, remove the tool window flag[/QUOTE]
Doh! yeah… thanks.
I appreciate the extra set of eyes.
These are some great tutorials for pyside. He actually covers the issue you are talking about and how you have to force it to close which wasn’t something he had to do in PYQT sooooo don’t feel too bad it’s a pretty common problem