Python--easygui

Source: Internet
Author: User

1.msgbox

Import Easygui as eg# msgbox# generally uses three parameters, msg: Content, Title: Caption, Ok_button: Button content Eg.msgbox (msg= "Shin yuan garments good earpick", title= "Gakki", Ok_ Button= "Come on!")

  

2.ccbox

Import Easygui as eg# ccbox# and MsgBox, the main use of three parameters # msg: Content, Title: title, Choices: Select items, can only put two options. # The function has a return value, if the choices point is the left return true, the right side returns Falseif Eg.ccbox (msg= "I am an old rascal", title= "rogue", choices= ("Yes", "no"):    print ( "It's your sister." Else:    print ("That's Right")    # Click Yes, execute if# Click No, return False, execute else

  

3.buttonbox

Import Easygui as eg# buttonbox# parameter does not introduce, this function also has the return value, which one you point, returns which A = Eg.buttonbox (msg= "which is your wife", title= "choose Wife", choices= ( "and Spring Yarn Mist", "Quartet Jasmine", "Sakamoto on the Smart Generation")) print (a)  # on the Smart generation

  

4.indexbox (), like the Buttonbox () function, the difference is to click the first one to return 0, and so on, instead of returning the text

5. Display the picture in Buttonbox ()

Import Easygui as Ega = Eg.buttonbox (msg= "My wife is cute?", title= "my Wife",             choices= ("cute", "very cute", "super cute"),             image=r "C: \ Users\administrator\desktop\ my wife. jpg ") print (a)  # super cute

  

6.choicebox

Import Easygui as Ega = Eg.choicebox (msg= "Who Are you?" "Title=" who ",                 choices=[" Harry Potter "," Conan Doyle "," Agatha Christie "," no survivors "]) print (a)" [0] Agatha Christie "

  

7.mutchoicebox

Import Easygui as Ega = Eg.multchoicebox (msg= "which book Do you Like", title= "books",                     choices=["Murder on the Orient Express", "No Survivors", "Massacre on the Nile", "ABC murder "]) print (a)  # [' Murder on the Orient Express ', ' no survivors ', ' Massacre on the Nile ', ' abc murder ']

  

8.enterbox

Import Easygui as Ega = Eg.enterbox (msg= "Speak Your Mind", title= "mind",                Strip=true,  # The return value is stripped by default                image=r "c \ Users\administrator\desktop\ my wife. jpg ") print (a)  # I love the Shin-knot coat

  

9.integerbox

Import Easygui as Ega = Eg.integerbox (msg= "Please make a point for my wife's face value", title= "score",                  lowerbound=1,  # If the input is not between 1 and 100 points, Will ask to reenter                  upperbound=100,                  image=r "C:\Users\Administrator\Desktop\ my wife. jpg") print (a)  # 100

  

If it's not between 1 and 100,

Will error, let re-enter

10.multenterbox

Import Easygui as Egmsg = "Please enter your wife's personal information (with * required)" title = "Info" FieldNames = ["* name", "Height", "age", "* husband"]fieldvalues = Eg.multen Terbox (msg, title, fields=fieldnames) while 1:    # If the user cancels    the operation if fieldvalues = = None: Break    errmsg = ""    For index in range (len (fieldnames)):        if fieldvalues[index].strip () = = "" And Fieldnames[index].startswith ("*"):            ErrMsg + = f "{Fieldnames[index]} cannot be empty"    if not errmsg:        break    # values represent our pre-set padding values, if the user input is not valid, Then the input will not disappear    fieldvalues = Eg.multenterbox (errmsg, title, Fields=fieldnames, values=fieldvalues) info = { Fieldnames[i]: fieldvalues[i] for I in range (len (fieldnames))}print (f "Your wife's message is: {info}")  # Your wife's message is: {' * name ': ' Shin-tie ', ' Height ': ' 169 ', ' age ': ' 30 ', ' * husband ': ' Pig Brother '}

  

# if not filled with an asterisk

11.passwordbox

Import Easygui as Ega = Eg.passwordbox (msg= "Please enter your password") print (a)  # 123456

  

12.multpasswordbox

Import Easygui as eg# fields can be set multiple, the last input by default is * *, generally the last as a password # values is we automatically set the value of a = Eg.multpasswordbox (msg= "Please enter user information", Fields= ("username", "email", "password"), values= ("xxx", "[email protected]", "* * * * *")) print (a)  # [' Shin-tie ', ' [email protected] ', ' 123456 ']

  

Summary: Easygui of these functions, the parameters are almost similar.

Python--easygui

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.