Widgets

Core widgets

Tkinter implements a fairly small set of core widgets, from which other widgets or complete applications can be based. Table 20.1 lists these core widgets with a short description of how they are used.

Table 20.1. Core Tkinter Widgets

Widget Name

Description

Toplevel

Toplevel widgets are special in that they have no master widget and don’t support any of the geometry-management methods (as discussed later). All other widgets are directly or indirectly associated with a Toplevel widget.

Frame

Used as a container widget for other child widgets. For instance, the tkDemo example consists of a number of frames within frames within frames to achieve its particular layout.

Label

Displays text or images.

Message

Displays text with automatic line-break and justification capabilities.

Text

Displays text with advanced formatting, editing, and highly interactive capabilities.

Canvas

Displays graphical items from a display list, with highly interactive capabilities.

Button, Checkbox, Entry, Scale, Radiobutton, List box, Scrollbar

Standard simple entry widgets, also known as the control widgets.

Menu, Menubutton

Widgets for implementing and responding to menus.

Quite a few of these widgets are demonstrated in the tkBrowser sample, and every one gets an exercise in the tkDemo sample, so you are encouraged to experiment with these samples to get a feel for the capabilities of each widget. Of these widgets, we will discuss two of the most popular and powerful ...

Get Python Programming On Win32 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.