Quick Reference for breezypythongui

To use this quick reference, select a class from the following list.  After browsing the information for that class, you can return to this point to make further selections.

Note that the tkinter parent class of each breezypythongui class appears in parentheses.  For complete documentation on the tkinter classes, consult the Python Web site.

 

breezypythongui Classes

tkinter Classes

EasyCanvas(tkinter.Canvas)

Button

EasyCheckbutton(tkinter.Checkbutton)

Label

EasyDialog(tkinter.simpleDialog.Dialog)

Frame

EasyFrame(tkinter.Frame)

Radiobutton

EasyListbox(tkinter.Listbox)

Scale

EasyMenuBar(Frame)

 

EasyMenubutton(tkinter.Menubutton)

 

EasyMenuItem(object)

 

EasyPanel(Frame)

 

EasyRadioButtonGroup(tkinter.Frame)

 

FloatField(tkinter.Entry)

 

IntegerField(tkinter.Entry)

 

TextField(tkinter.Entry)

 

TextArea(tkinter.Text)

 

 

 

EasyCanvas

This class represents a rectangular area in which geometric shapes, text, or images can be drawn.  It includes all of the methods of its parent class, tkinter.Canvas, as well as methods to draw geometric shapes and text and methods to handle mouse events.  You can subclass EasyCanvas to define specialized canvases, or use it as the default type of canvas in graphics applications.

EasyCanvas Method

What it does

drawImage(image, x, y,

          anchor = "center")

Draws the given PhotoImage at the given coordinates and returns the ID number of the image.  The image is centered at the coordinates by default.

drawLine(x0, y0, x1, y1,

         fill = "black",

         width = 1)

Draws a line segment with the given end points, color, and width. Returns the ID number of the line segment.

drawOval(x0, y0, x1, y1,

         outline = "black",

         fill = None)

Draws an oval with the given imaginary corner points, outline, and fill colors.  Returns the ID number of the oval.

drawRectangle(x0, y0, x1, y1,

              outline = "black",

              fill = None)

Draws a rectangle with the given corner points, outline, and fill colors.  Returns the ID number of the rectangle.

 

tkinter.Canvas Method

 

What it does

coords(itemId)

Returns a list of the itemŐs current coordinates (corner points of ovals and rectangles, end points of line segments, center point of text and images).

delete(itemId)

Removes the item from the canvas.

move(itemId, xDistance,

     yDistance)

Moves the item the given xDistance and yDistance.

scale(itemId, xOrigin, yOrigin,

      xScale, yScale)

Scales the item by the xScale and yScale factors (1.0 is no scale) relative to the xOrigin and yOrigin position.

 

Return to top

EasyCheckbutton

This class represents a labeled check box.  It includes all of the methods and attributes of its parent class, tkinter.Checkbutton, as well as a method to determine if the button is checked.

EasyCheckbutton Method

What it does

isChecked()

Returns True if the button is checked or False otherwise.

 

Return to top

 

EasyDialog

This class represents a popup dialog.  It includes all of the methods and attributes of its parent class, tkinter.simpleDialog.Dialog, as well as methods for adding widgets to the dialogŐs window.  A specialized dialog class is defined as a subclass of EasyDialog.  This subclass should include the __init__, body, and apply methods.  The __init__ method sets any window attributes.  The body method adds widgets to the dialogŐs window. Each method to add a widget includes the master argument that is received by the body method.  The apply method is run when the user selects the dialogŐs OK button. 

EasyDialog Method

What it does

addButton(master,

     text, row, column,

     rowspan = 1,

     columnspan = 1,

     command = lambda: None,

     state = NORMAL)

         

Creates a button (of type Button) with the given attributes, adds it to the dialogŐs window, and returns the button.

addCanvas(master,

     canvas = None,

     row = 0, column = 0,

     rowspan = 1,

     columnspan = 1,

     width = 200,

     height = 100,

     background = "white")

If canvas is None, creates a canvas (of type EasyCanvas) with the given attributes, adds it to the dialogŐs window, and returns the button.  Otherwise, adds the callerŐs canvas to the window and returns the canvas.

addCheckbutton(master,

     text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     sticky = N+S+E+W,

     command = lambda : 0)

Creates a check button (of type EasyCheckbutton) with the given attributes, adds it to the dialogŐs window, and returns the button.

addFloatField(master,

     value, row,

     column,

     columnspan = 1,

     rowspan = 1,

     width = 20,

     precision = None,

     sticky = N+E,

     state = NORMAL)

Creates a float field (of type FloatField) with the given attributes, adds it to the window, and returns the field.

addIntegerField(master,

     value, row,

     column,

     columnspan = 1,

     rowspan = 1,

     width = 20,

     sticky = N+E,

     state = NORMAL)

Creates an integer field (of type IntegerField) with the given attributes, adds it to the window, and returns the field.

addLabel(master,

     text, row, column,

     columnspan = 1,

     rowspan = 1,

     sticky = N+W,

     font = None,

     background = "white",    

     foreground = "black")

Creates a label (of type Label) with the given attributes, adds it to the window, and returns the label.

addListbox(master,

     row, column,  

     rowspan = 1,

     columnspan = 1,

     width = 10,

     height = 5,

     listItemSelected =

     lambda index: index)

Creates a list box (of type EasyListbox) with the given attributes, adds it to the window, and returns the list box.

addMenuBar(master,

     row, column,

     rowspan = 1,

     columnspan = 1,

     orient = HORIZONTAL)

Creates a menu bar (of type EasyMenuBar) with the given attributes, adds it to the window, and returns the menu bar.

addPanel(master, row, column,

     rowspan = 1,

     columnspan = 1,

     background = "white")

Creates a panel (of type EasyPanel) with the given attributes, adds it to the window, and returns the panel.

addRadiobutton(master,

     buttonGroup,

     text,

     command = lambda : 0)

Creates a radio button (of type Radiobutton) with the given attributes, adds it to buttonGroup, and returns the radio button.

addRadiobuttonGroup(master,

     row,

     column,

     rowspan = 1,

     columnspan = 1,

     orient = VERTICAL)

Creates a radio button group (of type EasyRadiobuttonGroup) with the given attributes, adds it to the window, and returns the radio button group.

addScale (master,

     row, column,

     rowspan = 1,

     columnspan = 1,

     command =

     lambda value: value,

     from_ = 0,

     to = 0,

     label = "",

     length = 100,

     orient = HORIZONTAL,

     resolution = 1,

     tickinterval = 0)

Creates a sliding scale (of type Scale) with the given attributes, adds it to the window, and returns the sliding scale.

addTextArea(master,

     text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     width = 80,

     height = 5,

     wrap = NONE)

Creates a text area (of type TextArea) with the given attributes, adds it to the window, and returns the text area.

addTextField(master,

     text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     width = 20,

     sticky = N+E,

     state = NORMAL)

Creates a text field (of type TextField) with the given attributes, adds it to the window, and returns the text field.

apply()

The dialog runs this method when the user closes it by selecting its OK button.   This method should be overridden by the subclass to perform any necessary actions.

body(master)

Adds widgets to the dialogŐs window using the usual methods, but with master as an additional first argument to these methods.  This method should be overridden by the subclass to perform these actions.

messageBox(title = "",

     message = "",

     width = 25,

     height = 5

Pops up a message box with the given attributes and waits for the user to close it.

modified()

Returns True if the dialogŐs OK button was clicked, or False otherwise.

prompterBox(title = "",

     promptString = "",

     inputText = "",

     fieldWidth = 20

Pops up a prompter box with the given attributes and waits for the user to close it.  Returns the input text in the entry field.

setModified(aBoolean)

Resets the dialogŐs modified property to True or False.  This method should be called within the dialogŐs apply method.

 

Return to top

EasyFrame

This class represents a top-level application window.  It includes all of the methods and attributes of its parent class, tkinter.Frame, as well as methods for adding widgets to the window.

EasyFrame Method

What it does

addButton(text, row, column,

     rowspan = 1,

     columnspan = 1,

     command = lambda: None,

     state = NORMAL)

         

Creates a button (of type Button) with the given attributes, adds it to the window, and returns the button.

addCanvas(canvas = None,

     row = 0, column = 0,

     rowspan = 1,

     columnspan = 1,

     width = 200,

     height = 100,

     background = "white")

If canvas is None, creates a canvas (of type EasyCanvas) with the given attributes, adds it to the window, and returns the button.  Otherwise, adds the callerŐs canvas to the window and returns the canvas.

addCheckbutton(text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     sticky = N+S+E+W,

     command = lambda : 0)

Creates a check button (of type EasyCheckbutton) with the given attributes, adds it to the window, and returns the button.

addFloatField(value, row,

     column,

     columnspan = 1,

     rowspan = 1,

     width = 20,

     precision = None,

     sticky = N+E,

     state = NORMAL)

Creates a float field (of type FloatField) with the given attributes, adds it to the window, and returns the field.

addIntegerField(value, row,

     column,

     columnspan = 1,

     rowspan = 1,

     width = 20,

     sticky = N+E,

     state = NORMAL)

Creates an integer field (of type IntegerField) with the given attributes, adds it to the window, and returns the field.

addLabel(text, row, column,

     columnspan = 1,

     rowspan = 1,

     sticky = N+W,

     font = None,

     background = "white",    

     foreground = "black")

Creates a label (of type Label) with the given attributes, adds it to the window, and returns the label.

addListbox(row, column,   

     rowspan = 1,

     columnspan = 1,

     width = 10,

     height = 5,

     listItemSelected =

     lambda index: index)

Creates a list box (of type EasyListbox) with the given attributes, adds it to the window, and returns the list box.

addMenuBar(row, column,

     rowspan = 1,

     columnspan = 1,

     orient = HORIZONTAL)

Creates a menu bar (of type EasyMenuBar) with the given attributes, adds it to the window, and returns the menu bar.

addPanel(row, column,

     rowspan = 1,

     columnspan = 1,

     background = "white")

Creates a panel (of type EasyPanel) with the given attributes, adds it to the window, and returns the panel.

addRadiobutton(buttonGroup,

     text,

     command = lambda : 0)

Creates a radio button (of type Radiobutton) with the given attributes, adds it to buttonGroup, and returns the radio button.

addRadiobuttonGroup(row,

     column,

     rowspan = 1,

     columnspan = 1,

     orient = VERTICAL)

Creates a radio button group (of type EasyRadiobuttonGroup) with the given attributes, adds it to the window, and returns the radio button group.

addScale (row, column,

     rowspan = 1,

     columnspan = 1,

     command =

     lambda value: value,

     from_ = 0,

     to = 0,

     label = "",

     length = 100,

     orient = HORIZONTAL,

     resolution = 1,

     tickinterval = 0)

Creates a sliding scale (of type Scale) with the given attributes, adds it to the window, and returns the sliding scale.

addTextArea(text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     width = 80,

     height = 5,

     wrap = NONE)

Creates a text area (of type TextArea) with the given attributes, adds it to the window, and returns the text area.

addTextField(text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     width = 20,

     sticky = N+E,

     state = NORMAL)

Creates a text field (of type TextField) with the given attributes, adds it to the window, and returns the text field.

messageBox(title = "",

     message = "",

     width = 25,

     height = 5

Pops up a message box with the given attributes and waits for the user to close it.

prompterBox(title = "",

     promptString = "",

     inputText = "",

     fieldWidth = 20

Pops up a prompter box with the given attributes and waits for the user to close it.  Returns the input text in the entry field.

setBackground(color)

Resets the window's background color to color.

setResizable(aBoolean)

Resets the window's resizable property to True or False.

setSize(width, height)

Resets the window's width and height in pixels.

setTitle(title)

Resets the window's title to title.

 

Return to top

EasyListbox

This class represents a scrolling list box.  It includes all of the methods and attributes of its parent class, tkinter.Listbox, as well as methods for handling user events.

EasyListbox Method

What it does

clear()

Deletes all of the items from the list box.

delete(index)

Deletes the item at index.

insert(index, item)

Inserts item at index, after shifting the other items down by one position.  If index is tkinter.END, inserts item after the last item.

getSelectedIndex()

Returns the index of the selected item, or -1 if no item is selected.

getSelectedItem()

Returns the selected item, or the empty string if no item is selected.

setSelectedIndex(index)

Selects the item at index, or does nothing if index < 0 or index >= size().

size()

Returns the number of items in the list box.

 

Return to top

EasyMenuBar

This class organizes menus in a frame.

EasyMenuBar Method

What it does

addMenu(text,

        state = NORMAL)

Creates a menu (of type EasyMenubutton) with the given attributes, adds it to the menu bar, and returns the menu.

 

Return to top

EasyMenubutton

This class represents a drop-down menu of command options.  It includes all of the methods and attributes of its parent class, tkinter.Menubutton.

EasyMenuButton Method

What it does

addMenuItem(text,

            command,

            state = NORMAL)

Creates a menu option (of type EasyMenuItem) with the given attributes, adds it to menu, and returns the menu option.

 

Return to top

EasyMenuItem

This class represents a command option in a menu button.  The subscript operator is used to access and modify the state of the menu item.

EasyMenuItem Method

What it does

setState(state)

Sets the state of the menu item to state.

 

Return to top

EasyPanel

This class represents a rectangular area that can contain widgets.  A panel can be added to the top-level window or to another panel.  A panel includes all of the methods and attributes of its parent class, tkinter.Frame, as well as methods for adding widgets to it.

EasyPanel Method

What it does

addButton(text, row, column,

     rowspan = 1,

     columnspan = 1,

     command = lambda: None,

     state = NORMAL

         

Creates a button (of type Button) with the given attributes, adds it to the panel, and returns the button.

addCanvas(canvas = None,

     row = 0, column = 0,

     rowspan = 1,

     columnspan = 1,

     width = 200,

     height = 100,

     background = "white")

If canvas is None, creates a canvas (of type EasyCanvas) with the given attributes, adds it to the window, and returns the button.  Otherwise, adds the callerŐs canvas to the panel and returns the canvas.

addCheckbutton(text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     sticky = N+S+E+W,

     command = lambda : 0)

Creates a check button (of type EasyCheckbutton) with the given attributes, adds it to the panel, and returns the button.

addFloatField(value, row,

     column,

     columnspan = 1,

     rowspan = 1,

     width = 20,

     precision = None,

     sticky = N+E,

     state = NORMAL)

Creates a float field (of type FloatField) with the given attributes, adds it to the panel, and returns the field.

addIntegerField(value, row,

     column,

     columnspan = 1,

     rowspan = 1,

     width = 20,

     sticky = N+E,

     state = NORMAL)

Creates an integer field (of type IntegerField) with the given attributes, adds it to the panel, and returns the field.

addLabel(text, row, column,

     columnspan = 1,

     rowspan = 1,

     sticky = N+W,

     font = None,

     background = "white",    

     foreground = "black")

Creates a label (of type Label) with the given attributes, adds it to the panel, and returns the label.

addListbox(row, column,  

     rowspan = 1,

     columnspan = 1,

     width = 10,

     height = 5,

     listItemSelected =

     lambda index: index)

Creates a list box (of type EasyListbox) with the given attributes, adds it to the panel, and returns the list box.

addMenuBar(row, column,

     rowspan = 1,

     columnspan = 1,

     orient = HORIZONTAL)

Creates a menu bar (of type EasyMenuBar) with the given attributes, adds it to the panel, and returns the menu bar.

addPanel(row, column,

     rowspan = 1,

     columnspan = 1,

     background = "white")

Creates a panel (of type EasyPanel) with the given attributes, adds it to the parent panel, and returns the new panel.

addRadiobutton(buttonGroup,

     text,

     command = lambda : 0)

Creates a radio button (of type Radiobutton) with the given attributes, adds it to buttonGroup, and returns the radio button.

addRadiobuttonGroup(row,

     column,

     rowspan = 1,

     columnspan = 1,

     orient = VERTICAL)

Creates a radio button group (of type EasyRadiobuttonGroup) with the given attributes, adds it to the panel, and returns the radio button group.

addScale (row, column,

     rowspan = 1,

     columnspan = 1,

     command =

     lambda value: value,

     from_ = 0,

     to = 0,

     label = "",

     length = 100,

     orient = HORIZONTAL,

     resolution = 1,

     tickinterval = 0)

Creates a sliding scale (of type Scale) with the given attributes, adds it to the panel, and returns the sliding scale.

addTextArea(text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     width = 80,

     height = 5,

     wrap = NONE)

Creates a text area (of type TextArea) with the given attributes, adds it to the panel, and returns the text area.

addTextField(text, row,

     column,

     rowspan = 1,

     columnspan = 1,

     width = 20,

     sticky = N+E,

     state = NORMAL)

Creates a text field (of type TextField) with the given attributes, adds it to the panel, and returns the text field.

setBackground(color)

Resets the panelŐs background color to color.

 

Return to top

EasyRadiobuttonGroup

This class represents a rectangular area containing a set of related radio buttons.  It includes all of the methods and attributes of its parent class, tkinter.Frame, as well as methods related to its set of radio buttons.

EasyRadiobuttonGroup Method

What it does

addButton(text, command)

Creates a new radio button with the given text and command, adds it to the group, and returns the radio button.  Raises a ValueError if the buttonŐs text is already in the group.

getSelectedButton()

Returns the currently selected button in the group.

setSelectedButton(button)

Sets the  selected button in the group to button.

 

Return to top

FloatField

This class represents a data field for input and output of floating-point numbers.  It includes all of the methods and attributes of its parent class, tkinter.Entry, as well as methods related to the I/O of numbers.

FloatField Method

What it does

getNumber()

Returns the number currently in the field.  Raises a ValueError if the field does not contain an integer or a floating-point number.

setNumber(number)

Sets the contents of the field to number.

setPrecision(precision)

Sets the precision used to display the number to precision.

 

Return to top

IntegerField

This class represents a data field for input and output of integers.  It includes all of the methods and attributes of its parent class, tkinter.Entry, as well as methods related to the I/O of numbers.

IntegerField Method

What it does

getNumber()

Returns the number currently in the field.  Raises a ValueError if the field does not contain an integer.

setNumber(number)

Sets the contents of the field to number.

 

 

Return to top

TextField

This class represents a data field for input and output of a single line of text.  It includes all of the methods and attributes of its parent class, tkinter.Entry, as well as methods related to the I/O text.

TextField Method

What it does

getText()

Returns the text currently in the field.

setText(text)

Sets the contents of the field to text.

 

 

Return to top

TextArea

This class represents a scrollable area for input and output of multiple lines of text.  It includes all of the methods and attributes of its parent class, tkinter.Text, as well as methods related to the I/O of text.

TextArea Method

What it does

appendText(text)

Appends text to the current contents of the text area.

getText()

Returns the text currently in the text area.

setText(text)

Sets the contents of the text area to text, replacing the current contents.

 

 

Return to top