- Install Easygui Tutorial http://www.cnblogs.com/zym941001/p/5323319.html
- 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.
- 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
- Select multiple options at the same time
Multchoicebox (msg= ", tilte=", choices= list, **kwargs) * *
- Let the user enter a message
- 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.
- Integerbox (msg,title,default,lowerbound=0,upperbound=99,image,root,**invalidkeywordargument)
- 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= ())
- Display text
- 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
- Codebox () equivalent to codebox=1 in ①
- Directories and files
- 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
- 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 ']
- Filesavebox (msg=none,title=none,default= ", Filestypes=none)
- Remember the user's settings
- 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.
- Catching exceptions
Exceptionbox () '
Easygui Basic Tutorials