simple IPython example raises exception on sys.exit()

前端 未结 5 853
一个人的身影
一个人的身影 2020-12-01 14:55

I\'m doing some very simple PySide (and PyQt) tutorials in IPython. One tutorial just creates a window with some sliders to demonstrate slots and signals.

When I clo

5条回答
  •  萌比男神i
    2020-12-01 15:19

    What you need to do is to cause the QApplication to be deleted later as in:

    app = QApplication(sys.argv)
    app.aboutToQuit.connect(app.deleteLater)
    

    Using this code you can rerun the application as many times as you want in IPython, or anywhere else and every time you close your qt application, the object will be deleted in python.

提交回复
热议问题