Chapter 4. Tkinter Classes

Table of Contents
Widget classes
Mixins

Widget classes

Tkinter supports 15 core widgets:

Table 4-1. Tkinter Widget Classes

WidgetDescription
ButtonA simple button, used to execute a command or other operation.
CanvasStructured graphics. This widget can be used to draw graphs and plots, create graphics editors, and to implement custom widgets.
CheckbuttonRepresents a variable that can have two distinct values. Clicking the button toggles between the values.
EntryA text entry field.
FrameA container widget. The frame can have a border and a background, and is used to group other widgets when creating an application or dialog layout.
LabelDisplays a text or an image.
ListboxDisplays a list of alternatives. The listbox can be configured to get radiobutton or checklist behavior.
MenuA menu pane. Used to implement pulldown and popup menus.
MenubuttonA menubutton. Used to implement pulldown menus.
MessageDisplay a text. Similar to the label widget, but can automatically wrap text to a given width or aspect ratio.
RadiobuttonRepresents one value of a variable that can have one of many values. Clicking the button sets the variable to that value, and clears all other radiobuttons associated with the same variable.
ScaleAllows you to set a numerical value by dragging a "slider".
ScrollbarStandard scrollbars for use with canvas, entry, listbox, and text widgets.
TextFormatted text display. Allows you to display and edit text with various styles and attributes. Also supports embedded images and windows.
ToplevelA container widget displayed as a separate, top-level window.

Also note that there's no widget class hierarchy in Tkinter; all widget classes are siblings in the inheritance tree.

All these widgets provide the Misc and geometry management methods, the configuration management methods, and additional methods defined by the widget itself. In addition, the Toplevel class also provides the window manager interface. This means that a typical widget class provides some 150 methods.