Easygui Basic Tutorials

Source: Internet
Author: User

    1. Install Easygui Tutorial http://www.cnblogs.com/zym941001/p/5323319.html
    2. Helloworld

      Import Easygui as G

      G.msgbox (' Hello world!! ')

2. Button assembly

①msgbox ()

MsgBox (msg= ' (Your message goes here) ', title= ', ok_button= ' OK ', image=none,root=none)

②ccbox ()

Ccbox (msg= ' shall I continue? ', title= ', choices= tuples, Image=none) This method returns 0 or 1

③ynbox ()

Ynbox (msg= ' shall I continue? ', title= ', choices= (' Yes ', ' no '), Image=none and ② like Ya Ya

④buttonbox (msg= ", title=", choices= tuple, Image=none,root=none) customizes a set of buttons that return the text content of the button when the user clicks on any one of the buttons. If the user cancels or closes the window, the default option (the first option) is returned.

⑤indexbox (), but not the text but the number ordinal, starting from 0.

⑥boolbox ()

Boolbox (msg= ", title=", Choices (' Yes ', ' no '), Image=none) If you press the first button to return 1, the reverse returns 0.

    1. Show pictures inside Buttonbox

      Set the image item in the above function to the name of the picture, note that only GIF format is supported

    2. Select multiple options at the same time

      Multchoicebox (msg= ", tilte=", choices= list, **kwargs) * *

    3. Let the user enter a message
      1. Enterbox (msg= ", title=", default= ", Strip=true,image=none,root=none) returns a string that is entered by the user, by default automatically removing the leading and trailing spaces, if you want to keep the settings strip=false.
      2. Integerbox (msg,title,default,lowerbound=0,upperbound=99,image,root,**invalidkeywordargument)
      3. Multenterbox (msg,title,fields= (), values= ()) If the user enters a value that is less than the option, the value in the returned list is populated with an empty string to populate the user with an input option. If the user enters a value that must be more than one option, the value in the returned list is truncated to the number of options. If the user cancels the operation, the value of the list in the domain or none is returned. **

5. Let the user enter the password

①passwordbox (Msg,title,default,image,root), returns the string entered by the user

②multpasswordbox (msg,title,field= (), values= ())

  1. Display text
    1. TextBox (msg,title,text,codebox=0) Default scale font (equal-width font when codebox=1) to display text content (wrapping) The textbox text parameter enables the String type list type or tuple type
    2. Codebox () equivalent to codebox=1 in ①
  2. Directories and files
    1. Diropenbox (Msg=none,title=none,default=none) provides a dialog box that returns the directory name selected by the user and returns none if the user chooses ' cancle '. The default parameter is used to set an open directory
    2. Fileopenbox (msg=none,title=none,default= ' * ', filetypes=none)

      about how to set the default parameter:

      The default parameter specifies a default path that typically contains one or more wildcard characters.

      • If the default parameter is set, Fileopenbox () displays the file path and format

      default default parameter is ' * ', which matches all format files

      About the Setup method for the FileTypes parameter:

      • You can make a list of strings that contain a file mask, for example: filetypes=[' *.txt ')

      ' Can be a list of strings, the last string of the list is a description of the file type, for example: filetypes=["*.css", [' *.htm ', ' *.html ', ' HTML files ']

    3. Filesavebox (msg=none,title=none,default= ", Filestypes=none)
  3. Remember the user's settings
    1. Egstore

      To implement the process of storing and recovering a user's settings, Easygui provides a class called Egstore. In order to remember certain settings, your application must define a class that inherits from the Egstore class. Your application must then create an object of that class. The constructor of the set class must initialize all of the values that you want to remember. Once you do this, you can instantiate the variable by setting the value in the ' Set object ' so that it is easy to remember the setting. Then use the Setting.store () method to persist the settings object on the hard disk.

  4. Catching exceptions

    Exceptionbox () '

Easygui Basic Tutorials

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.