Import Easygui, random
Secret = Random.randint (1,99)
Easygui.msgbox ("" "I have a secret, It's a number from 1-99 and you have 6 tries
. Ok let's do it. "" ")
Tries=0
Guess=0
While tries < 6 and guess! = secret:
Guess = easygui.integerbox("What ' s your guess,metey?")
Only integers are allowed, and if decimals can be used guess = float (easygui.enterbox ("What's Your Guess,metey?"))
If not guess:break
If guess < secret:
Easygui.msgbox (Str (guess) + "is too low!")
Elif Guess > Secret:
Easygui.msgbox (str (guess) + "is too high,landlubber!")
Tries = tries + 1
if guess = = secret:
Easygui.msgbox ("You Got It,congratulate")
Else
Easygui.msgbox ("No more chance.my secret is"+str (Secret), "Test")
Note that the easygui.msgbox corresponds to the/lib/easygui/__init__.py in the directory
This is what's in __init__.py.
__all__ = [' Buttonbox ',
' Diropenbox ',
' Fileopenbox ',
' Filesavebox ',
' TextBox ',
' Ynbox ',
' Ccbox ',
' Boolbox ',
' Indexbox ',
' MsgBox ',
' Integerbox ',
' Multenterbox ',
' Enterbox ',
' Exceptionbox ',
' Choicebox ',
' Codebox ',
' PasswordBox ',
' Multpasswordbox ',
' Multchoicebox ',
' Egstore ',
' Eg_version ',
' Egversion ',
' Abouteasygui ',
' Egdemo ',
]
# Import all functions that form the API
From. Boxes.button_box Import Buttonbox
From. Boxes.diropen_box Import Diropenbox
From. Boxes.fileopen_box Import Fileopenbox
From. Boxes.filesave_box Import Filesavebox
From. Boxes.text_box Import textbox
From. Boxes.derived_boxes Import Ynbox
From. Boxes.derived_boxes Import Ccbox
From. Boxes.derived_boxes Import Boolbox
From. Boxes.derived_boxes Import Indexbox
From. Boxes.derived_boxes Import MsgBox
The real directory here is the installation path/lib/boxes/derived_boxes
From. Boxes.derived_boxes Import Integerbox
From. Boxes.multi_fillable_box Import Multenterbox
From. Boxes.derived_boxes Import Enterbox
From. Boxes.derived_boxes Import Exceptionbox
From. Boxes.choice_box Import Choicebox
From. Boxes.derived_boxes Import Codebox
From. Boxes.derived_boxes Import PasswordBox
From. Boxes.multi_fillable_box Import Multpasswordbox
From. Boxes.choice_box Import Multchoicebox
From. Boxes.egstore Import Egstore, read_or_create_settings
From. Boxes.about import eg_version, egversion, Abouteasygui
From. Boxes.demo Import Easygui_demo as Egdemo
MsgBox (msg= "(Your message goes here)", title= ",
Ok_button= "OK", Image=none, Root=none): use format.
Easygui.msgbox ("" "I have a secret, It's a number from 1-99 and you have 6 tries
. Ok let's do it. "" "," Test "," YES "," d:/picture/2.gif ")//is the use case
Use effect 650) this.width=650; "Src=" Https://s1.51cto.com/wyfs02/M02/A4/EC/wKioL1m0nP3Rh1l0AACObKVg8JY729.jpg-wh_ 500x0-wm_3-wmp_4-s_2506477959.jpg "title=" 36020170910100201344.jpg "alt=" Wkiol1m0np3rh1l0aacobkvg8jy729.jpg-wh_ "/>
Import Easygui
Name = Easygui.enterbox ("What ' s your name?")
Room_num = Easygui.enterbox ("What's Your The number?")
Street_num = Easygui.enterbox ("What ' s your street name?")
City = Easygui.enterbox ("What's Your city?")
Province = Easygui.enterbox ("What ' s your province?")
Country = Easygui.enterbox ("What ' s your country?")
Easygui.msgbox ("name=" +name+"\ r \ n"+ "room_num=" +room_num+ "\ r \ n" + "Street_num" +street_num+ " \ r \ n "+" city "+city+
"\ r \ n" + "province" +province+ "\ r \ n" + "Country" +country)
"\ r \ n" is the key to the line display, if the Linux system is "\ n".
This article is from the "Gusu City" blog, make sure to keep this source http://ji123.blog.51cto.com/11333309/1964087
Python 2nd day