PyDocs

Graphical user interfaces with Tk

tkinter

The tkinter package (“Tk interface”) is the standard Python interface to the Tcl/Tk GUI toolkit. Both Tk and tkinter are available on most Unix platforms, including macOS, as well as on Windows systems.
Symbols in tkinter

a

ACTIVE
Values for the state option of various widgets and items.
ALL
The special tag 'all', which matches every item of a Canvas or every character of a Text (for example canvas.delete(ALL)).
ANCHOR
Symbolic indices used by the Text, Entry, Listbox and Canvas widgets, such as 'insert' (the insertion cursor), 'current', 'end', 'anchor' and the bounds of the selection ('sel.first' and 'sel.last').
ARC
Values for the style option of Canvas arc items.

b

BASELINE
The text-alignment value 'baseline'.
BaseWidget
Internal base class for all widgets.
BEVEL
Values for the capstyle ('butt', 'projecting', 'round') and joinstyle ('round', 'bevel', 'miter') options of Canvas line items.
BitmapImage
A two-color image (the Tk bitmap image type) created from an X11 bitmap.
BooleanVar
A Variable subclass that holds a boolean.
BOTH
Values for the fill option of the packer: 'x', 'y', 'both' or 'none'.
BOTTOM
Sides for the side option of the packer (see Pack.pack_configure()).
BROWSE
Values for the selectmode option of the Listbox widget.
BUTT
Values for the capstyle ('butt', 'projecting', 'round') and joinstyle ('round', 'bevel', 'miter') options of Canvas line items.
Button
A Button widget displays a textual string, bitmap or image and invokes a command when the user presses it (by clicking mouse button 1 over the button or, when the button has focus, by pressing the sp…

c

CallWrapper
Internal helper that wraps a Python callback so that it can be invoked from Tcl.
Canvas
A Canvas widget implements structured graphics.
CASCADE
Menu entry types, used as the itemType argument of Menu.add() and Menu.insert().
CENTER
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
CHAR
Values for the wrap option of the Text widget, selecting line wrapping on character or word boundaries.
Checkbutton
A Checkbutton widget displays a textual string, bitmap or image together with a square indicator, and toggles a boolean selection when pressed.
CHECKBUTTON
Menu entry types, used as the itemType argument of Menu.add() and Menu.insert().
CHORD
Values for the style option of Canvas arc items.
COMMAND
Menu entry types, used as the itemType argument of Menu.add() and Menu.insert().
CURRENT
Symbolic indices used by the Text, Entry, Listbox and Canvas widgets, such as 'insert' (the insertion cursor), 'current', 'end', 'anchor' and the bounds of the selection ('sel.first' and 'sel.last').

d

DISABLED
Values for the state option of various widgets and items.
DOTBOX
Other option values: 'underline', 'numeric' and 'dotbox'.
DoubleVar
A Variable subclass that holds a float.

e

E
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
END
Symbolic indices used by the Text, Entry, Listbox and Canvas widgets, such as 'insert' (the insertion cursor), 'current', 'end', 'anchor' and the bounds of the selection ('sel.first' and 'sel.last').
Entry
An Entry widget displays a single line of text and lets the user edit it.
Event
A container for the attributes of an event passed to a callback bound with Misc.bind().
EventType
An enum.StrEnum enumerating the Tk event types, used as the value of Event.type.
EW
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
EXCEPTION
Constants used in the mask arguments.
EXTENDED
Values for the selectmode option of the Listbox widget.

f

FALSE
Falsy values, all equal to the integer 0.
FIRST
Values for the arrow option of Canvas line items, indicating which ends have arrowheads.
FLAT
Values for the relief option, which controls a widget’s 3-D border.
Frame
A Frame widget is a simple container.

g

getboolean
Convert the Tcl boolean string s (one of '1', 'true', 'yes', 'on' and similar, or their false counterparts) to a Python bool.
getdouble
Convert s to a floating-point number.
getint
Convert s to an integer.
Grid
Geometry manager that arranges widgets in a two-dimensional grid of rows and columns within their container.
GROOVE
Values for the relief option, which controls a widget’s 3-D border.

h

HIDDEN
Values for the state option of various widgets and items.
HORIZONTAL
Values for the orient option of widgets such as Scale, Scrollbar and PanedWindow.

i

Image
Base class for Tk images.
image_names
Return the names of all existing images in the default root’s interpreter.
image_types
Return the available image types (such as 'photo' and 'bitmap') in the default root’s interpreter.
INSERT
Symbolic indices used by the Text, Entry, Listbox and Canvas widgets, such as 'insert' (the insertion cursor), 'current', 'end', 'anchor' and the bounds of the selection ('sel.first' and 'sel.last').
INSIDE
Values for the bordermode option of the placer (see Place.place_configure()).
IntVar
A Variable subclass that holds an integer.

l

Label
A Label widget displays a non-interactive textual string, bitmap or image.
LabelFrame
A LabelFrame widget is a container that has the features of a Frame plus the ability to display a label.
LAST
Values for the arrow option of Canvas line items, indicating which ends have arrowheads.
LEFT
Sides for the side option of the packer (see Pack.pack_configure()).
Listbox
A Listbox widget displays a list of single-line text items, one per line, of which the user can select one or more.

m

mainloop
Run the Tk main event loop on the default root window until all windows are destroyed.
Menu
A Menu widget displays a column of entries, each of which may be a command, a checkbutton, a radiobutton, a cascade (which posts an associated submenu) or a separator.
Menubutton
A Menubutton widget displays a textual string, bitmap or image and posts an associated Menu, given by its menu option, when the user presses it.
Message
A Message widget displays a non-interactive textual string, given by the text option or linked to a variable through textvariable.
Misc
The Misc class is a mix-in inherited by Tk and, through BaseWidget, by every widget.
MITER
Values for the capstyle ('butt', 'projecting', 'round') and joinstyle ('round', 'bevel', 'miter') options of Canvas line items.
MOVETO
The first argument passed by a Scrollbar to the XView.xview() or YView.yview() method of the scrolled widget.
MULTIPLE
Values for the selectmode option of the Listbox widget.

n

N
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
NE
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
NO
Falsy values, all equal to the integer 0.
NoDefaultRoot
Inhibit the creation of an implicit default root window.
NONE
Values for the fill option of the packer: 'x', 'y', 'both' or 'none'.
NORMAL
Values for the state option of various widgets and items.
NS
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
NSEW
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
NUMERIC
Other option values: 'underline', 'numeric' and 'dotbox'.
NW
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().

o

OFF
Falsy values, all equal to the integer 0.
ON
Truthy values, all equal to the integer 1.
OptionMenu
A helper subclass of Menubutton that displays a pop-up menu of mutually exclusive choices.
OUTSIDE
Values for the bordermode option of the placer (see Place.place_configure()).

p

Pack
Geometry manager that arranges widgets by packing them against the sides of their container.
PAGES
Values for the what argument of XView.xview_scroll() and YView.yview_scroll().
PanedWindow
A PanedWindow is a geometry-manager widget that arranges any number of child panes in a row (when orient is 'horizontal') or a column (when orient is 'vertical').
PhotoImage
A full-color image (the Tk photo image type), stored internally with a varying degree of transparency per pixel.
PIESLICE
Values for the style option of Canvas arc items.
Place
Geometry manager that places widgets at explicit positions and sizes within their container.
PROJECTING
Values for the capstyle ('butt', 'projecting', 'round') and joinstyle ('round', 'bevel', 'miter') options of Canvas line items.

r

Radiobutton
A Radiobutton widget displays a textual string, bitmap or image together with a diamond or circular indicator, and selects one choice out of several.
RADIOBUTTON
Menu entry types, used as the itemType argument of Menu.add() and Menu.insert().
RAISED
Values for the relief option, which controls a widget’s 3-D border.
READABLE
Constants used in the mask arguments.
RIDGE
Values for the relief option, which controls a widget’s 3-D border.
RIGHT
Sides for the side option of the packer (see Pack.pack_configure()).
ROUND
Values for the capstyle ('butt', 'projecting', 'round') and joinstyle ('round', 'bevel', 'miter') options of Canvas line items.

s

S
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
Scale
A Scale widget lets the user select a numerical value by moving a slider along a trough.
SCROLL
The first argument passed by a Scrollbar to the XView.xview() or YView.yview() method of the scrolled widget.
Scrollbar
A Scrollbar widget displays a slider and two arrows that let the user scroll an associated widget, such as a Listbox, Text, Canvas or Entry.
SE
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
SEL
Symbolic indices used by the Text, Entry, Listbox and Canvas widgets, such as 'insert' (the insertion cursor), 'current', 'end', 'anchor' and the bounds of the selection ('sel.first' and 'sel.last').
SEL_FIRST
Symbolic indices used by the Text, Entry, Listbox and Canvas widgets, such as 'insert' (the insertion cursor), 'current', 'end', 'anchor' and the bounds of the selection ('sel.first' and 'sel.last').
SEL_LAST
Symbolic indices used by the Text, Entry, Listbox and Canvas widgets, such as 'insert' (the insertion cursor), 'current', 'end', 'anchor' and the bounds of the selection ('sel.first' and 'sel.last').
SEPARATOR
Menu entry types, used as the itemType argument of Menu.add() and Menu.insert().
SINGLE
Values for the selectmode option of the Listbox widget.
SOLID
Values for the relief option, which controls a widget’s 3-D border.
Spinbox
A Spinbox widget is an Entry-like widget with a pair of up/down arrow buttons that let the user step through a range of values in addition to editing the value directly.
StringVar
A Variable subclass that holds a string.
SUNKEN
Values for the relief option, which controls a widget’s 3-D border.
SW
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().

t

Tcl
The Tcl() function is a factory function which creates an object much like that created by the Tk class, except that it does not initialize the Tk subsystem.
TclError
The exception raised when a call into the Tcl interpreter fails, for example when a widget is given an unknown option or an invalid value.
Text
A Text widget displays and edits multi-line text.
Tk
Construct a toplevel Tk widget, which is usually the main window of an application, and initialize a Tcl interpreter for this widget.
TOP
Sides for the side option of the packer (see Pack.pack_configure()).
Toplevel
A Toplevel widget is a top-level window, similar to a Frame except that its X parent is the root window of a screen rather than its logical parent.
TRUE
Truthy values, all equal to the integer 1.

u

UNDERLINE
Other option values: 'underline', 'numeric' and 'dotbox'.
UNITS
Values for the what argument of XView.xview_scroll() and YView.yview_scroll().

v

Variable
The base class for the Tk variable wrappers.
VERTICAL
Values for the orient option of widgets such as Scale, Scrollbar and PanedWindow.

w

W
Compass directions ('n', 's', 'e', 'w' and the diagonals and edges) plus CENTER ('center'), used as values for the anchor and sticky options and by methods such as Misc.grid_anchor().
Widget
Internal base class for the standard widgets.
Wm
The Wm mixin provides access to the window manager, allowing an application to control such things as the title, geometry and icon of a top-level window, the way it is resized, and how it responds to…
WORD
Values for the wrap option of the Text widget, selecting line wrapping on character or word boundaries.
WRITABLE
Constants used in the mask arguments.

x

X
Values for the fill option of the packer: 'x', 'y', 'both' or 'none'.
XView
Mix-in providing the horizontal-scrolling interface shared by widgets such as Entry, Canvas, Listbox, Text and Spinbox.

y

Y
Values for the fill option of the packer: 'x', 'y', 'both' or 'none'.
YES
Truthy values, all equal to the integer 1.
YView
Mix-in providing the vertical-scrolling interface shared by widgets such as Canvas, Listbox and Text.