Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
向Python测试添加GUI_Python_User Interface_Tkinter - Fatal编程技术网

向Python测试添加GUI

向Python测试添加GUI,python,user-interface,tkinter,Python,User Interface,Tkinter,Stackoverflow成员们好,我今天来找你们需要帮助,为我的Python测验添加tkinter GUI 来自随机导入洗牌 print(‘欢迎参加精彩的经济学问答!’ 打印('此测验将涉及简单的经济学问题') qas=[ (“问题”,“经济学”), (“问题”,“经济学”), (“问题”,“经济学”), (“问题”,“经济学”), (“问题”,“经济学”), ] 洗牌(qas) numRight=0 错误=[] numQuestions=int(输入(“有多少个问题?”) 对于问题,请用q

Stackoverflow成员们好,我今天来找你们需要帮助,为我的Python测验添加tkinter GUI

来自随机导入洗牌
print(‘欢迎参加精彩的经济学问答!’
打印('此测验将涉及简单的经济学问题')
qas=[
(“问题”,“经济学”),
(“问题”,“经济学”),
(“问题”,“经济学”),
(“问题”,“经济学”),
(“问题”,“经济学”),
]
洗牌(qas)
numRight=0
错误=[]
numQuestions=int(输入(“有多少个问题?”)
对于问题,请用qas[:numQuestions]正确回答:
回答=输入(问题+“”)
如果answer.lower()==rightAnswer:
打印('Right!')
numRight+=1
其他:
打印('否,答案是%s'%rightAnswer)
错。追加(问题)
打印('您答对了%d,但下列内容错了:'(numRight))
对于错误的q:

打印(q)
在任何脚本中添加GUI都不是那么简单。我的建议是使用Tkinter作为GUI,因为它是内置的。查看更多信息。

如果没有得到正确答案,请尝试

如果answer.lower是right,则回答:

而不是

if answer.lower()==rightAnswer:

要回答您关于GUI的问题,它太宽泛了。似乎当你说“你需要帮助”时,你希望我们中的一个人教你Tkinter的API以及如何应用它。这不是Stack Overflow的用途,因此我将向您介绍Bucky的Tkinter教程:


编辑:很抱歉,我没有意识到这篇文章是2015年的,而不是2016年的。希望它能帮助任何人解决未来的问题。

stackoverflow不是一种代码编写服务。尝试编写GUI,当你遇到一个特定的问题时,你可以回来询问。也许你应该在尝试实现GUI之前修复错误,然后阅读?这也不难。