【Jupyter】UserWarning: To exit: u

2018-03-22  本文已影响1143人  HBU_DAVID

if name == 'main':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
=====================
使用pyqt时候,pycharm中没事,Jupyter提示:
=====================
UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
=====================
解决方案:
if __name__ == '__main__':
app = QApplication(sys.argv)
app.aboutToQuit.connect(app.deleteLater)
ex = Example()
app.exec_()
=====================
ref:
https://stackoverflow.com/questions/25007104/what-the-error-when-i-close-the-dialog
https://stackoverflow.com/questions/10888045/simple-ipython-example-raises-exception-on-sys-exit

上一篇下一篇

猜你喜欢

热点阅读