我尝试使用pyqt5和python编写按钮事件,但是当我按下按钮时程序会报告错误
test2.py
public class Program
{
public static Game game1 {get; set;}
static void Main(string[] args)
{
game1 = new Game();
game1.SetQuestion1(GetInput());
game1.game();
game1.DisplayAll();
}
public static string GetInput()
{
string input = "";
do
{
WriteLine("Please enter your choice: Rock - 1, Paper - 2, Scissors - 3");
input = ReadLine();
}
while (game1.win < 4 || game1.lose < 4 || game1.usermoney == 0);
return input;
}
}
test2Index.py
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(400, 300)
self.plainTextEdit = QtWidgets.QPlainTextEdit(Form)
self.plainTextEdit.setGeometry(QtCore.QRect(110, 120, 104, 64))
self.plainTextEdit.setObjectName("plainTextEdit")
self.pushButton = QtWidgets.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(130, 60, 62, 19))
self.pushButton.setObjectName("pushButton")
self.retranslateUi(Form)
self.pushButton.clicked.connect(Form.BtnClick)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.pushButton.setText(_translate("Form", "PushButton"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())
当我运行testIndex.py并按下按钮时,它会出现: 流程结束,退出代码为-1073740791(0xC0000409)