小甲鱼的EasyGui学习文档为啥运行报错
本帖最后由 DummerSM 于 2022-3-15 19:30 编辑代码:
---------------------------------------------------------------------------------------------
import easygui as g
import sys
while 1:
g.msgbox("嗨,欢迎进入第一个界面小游戏^_^")
msg ="请问你希望在鱼C工作室学习到什么知识呢?"
title = "小游戏互动"
choices = ["谈恋爱", "编程", "OOXX", "琴棋书画"]
choice = g.choicebox(msg, title, choices)
# note that we convert choice to string, in case
# the user cancelled the choice, and we got None.
g.msgbox("你的选择是: " + str(choice), "结果")
msg = "你希望重新开始小游戏吗?"
title = "请选择"
if g.ccbox(msg, title): # show a Continue/Cancel dialog
pass# user chose Continue
else:
sys.exit(0) # user chose Cancel
运行结果(当第一个g.magbox语句执行完成后报错:)
---------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Users\Desktop\0.py", line 10, in <module>
choice = g.choicebox(msg, title, choices)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 38, in choicebox
mb = ChoiceBox(msg, title, choices, preselect=preselect,
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 123, in __init__
preselect_list = make_list_or_none(preselect, cast_type=int)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\easygui\boxes\choice_box.py", line 95, in make_list_or_none
if not isinstance(obj, collections.Sequence):
AttributeError: module 'collections' has no attribute 'Sequence'
运行代码后报这个错误,请问是为什么,python版本是3.10.2,有大佬知道嘛 https://fishc.com.cn/thread-204504-1-1.html 是因为easygui不兼容python3.10,可以用我刚刚发的网址来用 这是python版本问题,解决方法你可以看一下这个:
https://fishc.com.cn/forum.php?mod=redirect&goto=findpost&ptid=209134&pid=5739456
页:
[1]