# -*- coding:utf-8 -*-import easygui,randomstatus = easygui.buttonbox ("This is a guessing number game , click Start Game, click Exit to close the game. ", choices = [" Start "," Exit "]) if status == " Start ": s_number = random.randint (1,100) count = 0 u_number = 0 #print s_number while count < 6 and u_number != s_number: u_number = int (Easygui.enterbox ("Please enter a 1-100 number:")) if u_ number == s_number: Easygui.msgbox ("Congratulations on your guess right") break elif u_number < s_number: &Nbsp; easygui.msgbox ("small") #print u_number else: easygui.msgbox ("Big Up") #print u_number count = count + 1 else: Easygui.msgbox ("Six times you haven't guessed") #print s_numberelse: easygui.msgbox ("Quit the game! ") #print " Exit "
This article is from the "Romantic Laugh" blog, make sure to keep this source http://lmdtx.blog.51cto.com/6942028/1610849
Python GUI guessing number game