pyside 程序上的进程已完成,退出代码为 -1073740791 (0xC0000409)

问题描述 投票:0回答:1

我正在尝试运行一个小型 Pyside 程序,无论我做什么,我都会遇到此错误,这是我的代码。网上找不到任何相关信息,我的教授也不知道。

from PySide6.QtWidgets import QWidget, QVBoxLayout, QMainWindow, QApplication, QButtonGroup, QRadioButton
import sys


class MyQuiz(QMainWindow):

    def __init__(self):
        super().__init__()
        layout = QVBoxLayout()
        central_widget = QWidget()
        central_widget.setLayout(layout)
        self.setCentralWidget(central_widget)
        self.setWindowTitle("Quiz")

        #Question 1
        radio11 = QRadioButton("1")
        radio12 = QRadioButton("2")
        radio13 = QRadioButton("3")

        groupe_radio = QButtonGroup()
        groupe_radio.addButton(radio11)
        groupe_radio.addButton(radio12)
        groupe_radio.addButton(radio13)

        layout.addWidget(radio11)
        layout.addWidget(radio12)
        layout.addWidget(radio13)



window = MyQuiz()
app = QApplication(sys.argv)
window.show()
app.exec()

我尝试更改文件( ctrl + c ctrl + v 到新文件) 清除pycharm上的缓存 重新安装 pyside6

python stack-overflow
1个回答
0
投票

qapplication 是您想要实例化的第一个东西。它与您的文件或缓存无关。

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MyQuiz()
    window.show()
    app.exec()
© www.soinside.com 2019 - 2024. All rights reserved.