|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import easygui as g
import sys
while 1:
g.msgbox("嗨,欢迎进入第一个界面小游戏^_^")
msg ="请问你希望在鱼C工作室学习到什么知识呢?"
title = "小游戏互动"
choices = ["谈恋爱", "编程", "OOXX", "琴棋书画"]
choices = g.choicebox(msg, title, choices)
# 注意,msgbox的参数是一个字符串
# 如果用户选择Cancel,该函数返回None
g.msgbox("你的选择是: " + str(choice), "结果")
msg = "你希望重新开始小游戏吗?"
title = "请选择"
# 弹出一个Continue/Cancel对话框
if g.ccbox(msg, title):
pass # 如果用户选择Continue
else:
sys.exit(0) # 如果用户选择Cancel
========================= RESTART: E:/python(1)/1060.py ========================
Traceback (most recent call last):
File "E:/python(1)/1060.py", line 11, in <module>
choice = g.choicebox(msg, title, choices)
File "E:\PPYYTTHHOONN\lib\site-packages\easygui\boxes\choice_box.py", line 38, in choicebox
mb = ChoiceBox(msg, title, choices, preselect=preselect,
File "E:\PPYYTTHHOONN\lib\site-packages\easygui\boxes\choice_box.py", line 123, in __init__
preselect_list = make_list_or_none(preselect, cast_type=int)
File "E:\PPYYTTHHOONN\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的版本问题,你可以看一下我之前的帖子
https://fishc.com.cn/forum.php?m ... 456&ptid=209134
第二个问题:
(应该是 choice = g.choicebox(msg, title, choices),不是choices = g.choicebox(msg, title, choices))import easygui as g
import sys
while 1:
g.msgbox("嗨,欢迎进入第一个界面小游戏^_^")
msg ="请问你希望在鱼C工作室学习到什么知识呢?"
title = "小游戏互动"
choices = ["谈恋爱", "编程", "OOXX", "琴棋书画"]
choice = g.choicebox(msg, title, choices) # 这里应该是赋值给 choice
# 注意,msgbox的参数是一个字符串
# 如果用户选择Cancel,该函数返回None
g.msgbox("你的选择是: " + str(choice), "结果")
msg = "你希望重新开始小游戏吗?"
title = "请选择"
# 弹出一个Continue/Cancel对话框
if g.ccbox(msg, title):
pass # 如果用户选择Continue
else:
sys.exit(0) # 如果用户选择Cancel
|
|