我在IPython中做了一些非常简单的PySide(和PyQt)教程.一个教程只是创建一个带有一些滑块的窗口来演示插槽和信号.
当我关闭正在运行的演示应用程序的窗口时,我看到此错误:
An exception has occurred, use %tb to see the full traceback.
SystemExit: 0
To exit: use 'exit', 'quit', or Ctrl-D.
Run Code Online (Sandbox Code Playgroud)
所以我运行%tb并得到这个:
SystemExit Traceback (most recent call last)
/Workspaces/scratch/<ipython-input-1-88966dcfb499> in <module>()
33
34 if __name__ == "__main__":
---> 35 main()
/Workspaces/scratch/<ipython-input-1-88966dcfb499> in main()
29 w.show()
30 app.exec_()
---> 31 sys.exit(0)
32
33
SystemExit: 0
Run Code Online (Sandbox Code Playgroud)
如果我再次尝试执行我的代码,我会得到这个:
RuntimeError: A QApplication instance already exists.
Run Code Online (Sandbox Code Playgroud)
如果它有帮助,这里我的代码:
from PySide.QtCore import *
from PySide.QtGui import *
import sys
class MyWindow(QWidget):
def __init__(self):
QWidget.__init__(self, None)
vbox …Run Code Online (Sandbox Code Playgroud)