| Home | Trees | Indices | Help |
|---|
|
|
EasyGuiRevisionInfo = "version 0.83 2008-06-12"
EasyGui provides an easy-to-use interface for simple GUI interaction with a user. It does not require the programmer to know anything about tkinter, frames, widgets, callbacks or lambda. All GUI interactions are invoked by simple function calls that return results.
Documentation is in an accompanying file, easygui.txt.You may encounter problems using IDLE to run programs that use EasyGui. Try it and find out. EasyGui is a collection of Tkinter routines that run their own event loops. IDLE is also a Tkinter application, with its own event loop. The two may conflict, with the unpredictable results. If you find that you have problems, try running your program outside of IDLE.
Note that EasyGui requires Tk release 8.0 or greater.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
EasyGuiRevisionInfo =
|
|||
rootWindowPosition =
|
|||
DEFAULT_FONT_FAMILY =
|
|||
MONOSPACE_FONT_FAMILY =
|
|||
DEFAULT_FONT_SIZE = 10
|
|||
BIG_FONT_SIZE = 12
|
|||
SMALL_FONT_SIZE = 9
|
|||
CODEBOX_FONT_SIZE = 9
|
|||
TEXTBOX_FONT_SIZE = 10
|
|||
EASYGUI_ABOUT_INFORMATION =
|
|||
|
|||
Display a msgbox with choices of Yes and No. The default is "Yes". The returned value is calculated this way:
if the first choice ("Yes") is chosen, or if the dialog is cancelled:
return 1
else:
return 0
If invoked without a msg argument, displays a generic request for a
confirmation that the user wishes to continue. So it can be used this
way:
if ynbox(): pass # continue
else: sys.exit(0) # exit the program
|
Display a msgbox with choices of Continue and Cancel. The default is "Continue". The returned value is calculated this way:
if the first choice ("Continue") is chosen, or if the dialog is cancelled:
return 1
else:
return 0
If invoked without a msg argument, displays a generic request for a
confirmation that the user wishes to continue. So it can be used this
way:
if ccbox():
pass # continue
else:
sys.exit(0) # exit the program
|
Display a boolean msgbox. The default is the first choice. The returned value is calculated this way:
if the first choice is chosen, or if the dialog is cancelled:
returns 1
else:
returns 0
|
|
|
Show a box in which a user can enter an integer. In addition to arguments for msg and title, this function accepts integer arguments for default_value, lowerbound, and upperbound. The default_value argument may be None. When the user enters some text, the text is checked to verify that it can be converted to an integer between the lowerbound and upperbound. If it can be, the integer (not the text) is returned. If it cannot, then an error msg is displayed, and the integerbox is redisplayed. If the user cancels the operation, None is returned. |
Show screen with multiple data entry fields.
If there are fewer values than names, the list of values is padded with
empty strings until the number of values is the same as the number of names.
If there are more values than names, the list of values
is truncated so that there are as many values as names.
Returns a list of the values of the fields,
or None if the user cancels the operation.
Here is some example code, that shows how values returned from
multenterbox can be checked for validity before they are accepted::
----------------------------------------------------------------------
msg = "Enter your personal information"
title = "Credit Card Application"
fieldNames = ["Name","Street Address","City","State","ZipCode"]
fieldValues = [] # we start with blanks for the values
fieldValues = multenterbox(msg,title, fieldNames)
# make sure that none of the fields was left blank
while 1:
if fieldValues == None: break
errmsg = ""
for i in range(len(fieldNames)):
if fieldValues[i].strip() == "":
errmsg = errmsg + ('"%s" is a required field.
' % fieldNames[i])
if errmsg == "": break # no problems found
fieldValues = multenterbox(errmsg, title, fieldNames, fieldValues)
print "Reply was:", fieldValues
----------------------------------------------------------------------
@arg msg: the msg to be displayed.
@arg title: the window title
@arg fields: a list of fieldnames.
@arg values: a list of field values
|
Same interface as multenterbox. But in multpassword box,
the last of the fields is assumed to be a password, and
is masked with asterisks.
Here is some example code, that shows how values returned from
multpasswordbox can be checked for validity before they are accepted::
----------------------------------------------------------------------
msg = "Enter logon information"
title = "Demo of multpasswordbox"
fieldNames = ["Server ID", "User ID", "Password"]
fieldValues = [] # we start with blanks for the values
fieldValues = multpasswordbox(msg,title, fieldNames)
# make sure that none of the fields was left blank
while 1:
if fieldValues == None: break
errmsg = ""
for i in range(len(fieldNames)):
if fieldValues[i].strip() == "":
errmsg = errmsg + ('"%s" is a required field.
' % fieldNames[i])
if errmsg == "": break # no problems found
fieldValues = multpasswordbox(errmsg, title, fieldNames, fieldValues)
print "Reply was:", fieldValues
----------------------------------------------------------------------
|
Show a box in which a user can enter some text. You may optionally specify some default text, which will appear in the enterbox when it is displayed. Returns the text that the user entered, or None if he cancels the operation. By default, enterbox strips its result (i.e. removes leading and trailing whitespace). (If you want it not to strip, use keyword argument: strip=False.) This makes it easier to test the results of the call:
reply = enterbox(....)
if reply:
...
else:
...
|
|
|
|
|
Display some text in a monospaced font, with no line wrapping. This function is suitable for displaying code and text that is formatted using spaces. The text parameter should be a string, or a list or tuple of lines to be displayed in the textbox. |
Display some text in a proportional font with line wrapping at word breaks. This function is suitable for displaying general written text. The text parameter should be a string, or a list or tuple of lines to be displayed in the textbox. |
A dialog to get a directory name. Note that the msg argument, if specified, is ignored. Returns the name of a directory, or None if user chose to cancel. If the "default" argument specifies a directory name, and that directory exists, then the dialog box will start with that directory. |
A dialog to get a file name. Returns the name of a file, or None if user chose to cancel. If the "default" argument specifies a file name, then the dialog box will start with that file. |
A file to get the name of a file to save. Returns the name of a file, or None if user chose to cancel. If the "default" argument specifies a file name, then the dialog box will start with that file. |
|
|||
EASYGUI_ABOUT_INFORMATION
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jun 12 22:38:46 2008 | http://epydoc.sourceforge.net |