内核(Python 3.9.7)'使用pyqt5时死亡
我正在使用VSCODE上的Jupyter笔记本,而我是PYQT5的新手。当我运行这些代码行时,我会收到此错误消息
我尝试重新启动内核,并且每次一次工作一次但也不完全显示小部件。 是输出的屏幕截图
ps,我在Windows 10 16 GB RAM 64 bit上使用Anaconda 3和Python 3
这 我的代码:
import sys
from PyQt5.uic import loadUi
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QWidget, QApplication, QLineEdit, QTableWidget, QStackedWidget
from PyQt5.QtCore import *
class welcomescreen(QDialog):
def __init__(self):
super(welcomescreen,self).__init__()
loadUi("welcome.ui", self)
# main
app = QApplication(sys.argv)
if app is None:
app = QtWidgets.QApplication(sys.argv)
acceuil=welcomescreen() #object from the class above
widget=QStackedWidget()
widget.addWidget(acceuil)
widget.setFixedHeight(850)
widget.setFixedWidth(1200)
widget.show()
try:
sys.exit(app.exec_())
except:
print("Exiting")
I am using Jupyter Notebook on Vscode and I'm new to PyQt5. When I run these lines of code, I got this Error message
I tried restarting the kernel and it only works once each time it but doesn't display the widget fully either. Here's a screenshot of the output
PS, I am using Anaconda 3 and Python 3 on Windows 10 16 GB RAM 64 bit
And here's my code:
import sys
from PyQt5.uic import loadUi
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QWidget, QApplication, QLineEdit, QTableWidget, QStackedWidget
from PyQt5.QtCore import *
class welcomescreen(QDialog):
def __init__(self):
super(welcomescreen,self).__init__()
loadUi("welcome.ui", self)
# main
app = QApplication(sys.argv)
if app is None:
app = QtWidgets.QApplication(sys.argv)
acceuil=welcomescreen() #object from the class above
widget=QStackedWidget()
widget.addWidget(acceuil)
widget.setFixedHeight(850)
widget.setFixedWidth(1200)
widget.show()
try:
sys.exit(app.exec_())
except:
print("Exiting")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论