Search This Blog

Tuesday, October 1, 2013

Launching Python QApplication multiple times

Just a quick note here, in Qt / PySide code many users are use to just running:

    app = QtGui.QApplication(sys.argv)

In MaxPlus the proper way (I say proper as modules stay loaded when ran in MaxPlus) is to always replace sys.argv with [] and to also first check for a QApplication.instance:

    app = QtGui.QApplication.instance()
    if not app:
        app = QtGui.QApplication([])

No comments:

Post a Comment