My Mainclass creates a simple QmainWindows like this:
class mcManageUiC(QtGui.QMainWindow): def __init__(self): super(mcManageUiC, self).__init__() self.initUI() def initUI(self): self.show()
And at the end of my file, I run it like this:
def main(): app = QtGui.QApplication(sys.argv) renderManagerVar = mcManageUiC() sys.exit(app.exec_()) if __name__ == '__main__': main()
My problem is that every time I launch it, it launches a new window. I would like to know if there is a way to detect the existence of a previous instance of a class in my script (to close the old one or not start a new one) or any other solutions?
Also, when compiling my code with py2exe, the same problem is with my .exe file on Windows; he launches a new window every time. Can I add something to setup.py for Windows so that I donβt act like that?
Is it possible, if so, how?
Note. I am using 64-bit compilation of Windows 7 with eclipse.
source share