easygui的问题
import easygui as eimport sys
while True:
e.msgbox = ("欢迎进入第一个界面游戏(^_^)")
msg = "请问你希望了解哪些方面的知识?"
title = "小游戏互动"
choices = ["谈恋爱", "编程", "XXOO", "琴棋书画"]
choice = e.choicebox(msg, title, choices)
e.msgbox("你的选择是:" + str(choice), "结果")
msg = "你希望重新开始小游戏吗?"
title = "请选择"
if e.ccbox(msg,title):
pass
else:
sys.exit(0)
出现错误
raceback (most recent call last):
File "C:/Users/Documents/学习/PyCharm作业/GAME/实验.py", line 13, in <module>
e.msgbox("你的选择是:" + str(choice), "结果")
TypeError: 'str' object is not callable
Process finished with exit code 1
怎么解决
e.msgbox = ("欢迎进入第一个界面游戏(^_^)")
这个地方错了 , 改成:
e.msgbox("欢迎进入第一个界面游戏(^_^)")
完整代码:
import easygui as e
import sys
while True:
e.msgbox("欢迎进入第一个界面游戏(^_^)")
msg = "请问你希望了解哪些方面的知识?"
title = "小游戏互动"
choices = ["谈恋爱", "编程", "XXOO", "琴棋书画"]
choice = e.choicebox(msg, title, choices)
e.msgbox("你的选择是:" + str(choice),"结果")
msg = "你希望重新开始小游戏吗?"
title = "请选择"
if e.ccbox(msg,title):
pass
else:
sys.exit(0)
页:
[1]