|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import random
import easygui as g
g.msgbox("欢迎进入第一个界面小游戏^_^")
secret = random.randint(1,10)
msg = "不妨猜一下我心里想的数字(1~10):"
title = "数字小游戏"
guess = g.integerbox(msg, title, lowerbound=1, upperbound=10)
while True:
if guess == secret:
g.msgbox("不错,很聪明")
g.msgbox("猜对了也没有奖励")
break
else:
if guess > secret:
g.msgbox("大了,大了!")
else:
g.msgbox("嘿,小了")
guess = g.integerbox(msg, title, lowerbound=1, upperbound=10)
g.msgbox("游戏结束,不玩了")
这是我手打的代码,就是运行不来,就是窗口一闪就没了,小甲鱼的就可以,请各位兄弟姐妹儿帮我看看
冒号变成中文的了,这样试试:
- import random
- import easygui as g
- g.msgbox("欢迎进入第一个界面小游戏^_^")
- secret = random.randint(1,10)
- msg = "不妨猜一下我心里想的数字(1~10):"
- title = "数字小游戏"
- guess = g.integerbox(msg, title, lowerbound=1, upperbound=10)
- while True:
- if guess == secret:
- g.msgbox("不错,很聪明")
- g.msgbox("猜对了也没有奖励")
- break
- else:
- if guess > secret:
- g.msgbox("大了,大了!")
- else:
- g.msgbox("嘿,小了")
- guess = g.integerbox(msg, title, lowerbound=1, upperbound=10)
- g.msgbox("游戏结束,不玩了")
复制代码
|
|