|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import easygui as g
import random
import sys
def continue1():
""" if g.ccbox('continue?','check'):
pass
else:
sys.exit(0)
"""
result = g.ccbox('continue?','check')
if result == 1:
pass
else:
sys.exit(0)
def game():
while 1:
g.msgbox("Let's Play!")
number = [0,1,2,3,4,5,6,7,8,9]
title = 'guess number'
msg = '======='
flag=g.choicebox(msg,title,number)
num=random.randint(0,9)
if flag == str(num):
g.msgbox('wonderful!')
else:
g.msgbox('your num is '+str(flag)+',The answer is '+str(num))
continue1()
game()
一开始在判断ccbox的时候,用 result=='false' 判断结果不行,查看类型是boolean类型的,所以用0或1判断 |
|