#coding=utf-8
#---猜数字游戏--#
#GUI图形界面
from tkinter import *
import tkinter.simpledialog as dl #对话框
import tkinter.messagebox as mb #提示框
root = Tk() #Tk是tkinter类的一个函数 主函数的显示框
w = Label(root,text='Guess Num game')#Label是tkinter类的一个函数
w.pack() #根据字数自动调节标签框的大小
mb.showinfo('Welcome','Welcome to Guess Num game!')
num=59
count=1
while True:
guess_num=dl.askinteger("Num","what's your guess?")
if(guess_num==num):
output="Bingo, you made it !"
mb.showinfo("prompt",output)
break
elif(guess_num>num):
count=count+1
output="What a shame! you guess it bigger!"
mb.showinfo("prompt",output)
else:
count=count+1
output="what a shame! you guess it smaller!"
mb.showinfo("prompt",output)
print(count,"shot(s)! good job!")