无功 发表于 2020-8-18 12:56:41

easygui求助!!!

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   是什么意思?
望解答谢谢!!!

无功 发表于 2020-8-18 12:57:45

是输入下限为1上限为10的意思么

1q23w31 发表于 2020-8-18 13:03:22

无功 发表于 2020-8-18 12:57
是输入下限为1上限为10的意思么

integerbox(msg='', title=' ', default='', lowerbound=0, upperbound=99, image=None, root=None, **invalidKeywordArguments)

integerbox() 为用户提供一个简单的输入框,用户只能输入范围内(lowerbound参数设置最小值,upperbound参数设置最大值)的整型数值,否则会要求用户重新输入。

无功 发表于 2020-8-18 17:54:28

1q23w31 发表于 2020-8-18 13:03
integerbox() 为用户提供一个简单的输入框,用户只能输入范围内(lowerbound参数设置最小值,upperboun ...

谢谢
页: [1]
查看完整版本: easygui求助!!!