新的作品一退出重进就会显示错误是怎么回事?
import easyguiimport sys
while 1:
easygui.msgbox("hello")
msg = "How are you?"
title = "a boring game"
choices = ["There's none of you busness","I'am fine thank you","......"]
choice = easygui.choicebox(msg,title,choices)
if choice == "......":
easygui.msgbox("you didn't say anything")
easygui.msgbox("say some thing please.")
else:
easygui.msgbox("you say:"+str(choice),"end")
easygui.msgbox("Well")
easygui.msgbox("Some body ask you for the time.Even know you didn't know the actually time.")
msg = "What time is it?"
title = "a boring game"
choices = ["I don't know","Don't ask me","......","It's 9p.m."]
choice = easygui.choicebox(msg,title,choices)
if choice == "......":
easygui.msgbox("you didn't say anything")
easygui.msgbox("say some thing please.")
else:
if choice == "It's 9p.m.":
easygui.msgbox("you say:"+str(choice),"end")
easygui.msgbox("Are you kidding me.It still in the morning")
else:
easygui.msgbox("you say:"+str(choice),"end")
easygui.msgbox("Man who can tell me the time?")
easygui.msgbox("you went away.")
msg = "play it again?"
title = "chose"
if easygui.ccbox(msg,title):
pass
else:
sys.exit(0)
这一段代码开始还没问题,为什么退出去重进就会提示
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\easygui.py", line 1, in <module>
import easygui
File "C:\Users\Administrator\Desktop\easygui.py", line 5, in <module>
easygui.msgbox("hello")
AttributeError: 'module' object has no attribute 'msgbox' 把你的程序文件名改成其他的,总之不要命名为 easygui.py zltzlt 发表于 2020-8-4 12:07
把你的程序文件名改成其他的,总之不要命名为 easygui.py
谢谢{:10_266:}
将你的代码名更改,不要用模块名作为自己代码名,否则你导入自己需要使用的模块时候会导入自己写的脚本文件,导致报错
页:
[1]