shadowrock110
shadowrock110
2019-11-15 18:37

关于pyside2在pycharm中运行出错 app = QApplication(sys.argv) TypeError: 'NoneType' object is not callable?

  • python

在pycharm中运行这段报错:

import sys
from PySide2.QtWidgets import QApplication, QLabel
print(sys.argv)
app = QApplication.instance()
if app == None:
    app = QApplication(sys.argv)

# QLabel组件用于显示文本
label = QLabel("<font color=red size=40>Hello World!</font>")
label.show()
app.exec_()

Traceback (most recent call last):
  File "E:/工作/copy2/Test.py", line 7, in <module>
    app = QApplication(sys.argv)
TypeError: 'NoneType' object is not callable

但是在python编译器里面就不会报错,求指点?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答