PySide Qt script doesn't launch from Spyder but works from shell

前端 未结 4 1234
旧巷少年郎
旧巷少年郎 2020-12-20 07:26

I have a weird bug in my project that uses PySide for its Qt GUI, and in response I\'m trying to test with simpler code that sets up the environment.

Here is the cod

4条回答
  •  [愿得一人]
    2020-12-20 07:34

    I have the same problem, and somewhere on stackoverflow was a solution.

    Instead of

    qApp = QtGui.QApplication(sys.argv)
    

    Use

    qApp = QtGui.QApplication.instance()
    if qApp is None:
            qApp = QtGui.QApplication(sys.argv)
    

提交回复
热议问题