|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
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("游戏结束,不玩啦^_^")
中uess = g.integerbox(msg, title, lowerbound=1, upperbound=10)
中lowerbound , upperbound 是什么意思?
望解答谢谢!!!
- integerbox(msg='', title=' ', default='', lowerbound=0, upperbound=99, image=None, root=None, **invalidKeywordArguments)
复制代码
integerbox() 为用户提供一个简单的输入框,用户只能输入范围内(lowerbound参数设置最小值,upperbound参数设置最大值)的整型数值,否则会要求用户重新输入。
|
|