|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import random
import easygui
easygui.msgbox('欢迎来到tan的游戏界面')
secret = random.randint(1, 10)
msg = '猜猜我想的几?'
title = '数字小游戏'
guess = easygui.integerbox(msg, title, lowerbound=1, upperbound=10)
while True:
if guess == secret:
geasygui.msgbox('nice')
break
else:
if guess > secret:
easygui.msgbox('big')
else:
easygui.msgbox('small')
guess = easygui.integerbox(msg, title, lowerbound=1, upperbound=10)
easygui.msgbox('game over')
Traceback (most recent call last):
File "d:/learn/新版教学视频小甲鱼/35/daima.py", line 1, in <module>
import easygui as g
File "d:\learn\新版教学视频小甲鱼\35\easygui.py", line 4, in <module>
easygui.msgbox('欢迎来到tan的游戏界面')
AttributeError: partially initialized module 'easygui' has no attribute 'msgbox' (most likely due to
说是循环导入了,怎么办
文件名不要叫 easygui.py,因为会跟 EasyGUI 模块(也叫 easygui.py)冲突。
|
|