widgets, paned widgets, scrolled widgets, dialog windows, button boxes, balloon
help, and an interface to the Blt graph widget.
The interface to Pmw megawidgets is similar to that of basic tkinter widgets, so
Python scripts can freely mix Pmw megawidgets with standard tkinter widgets.
Moreover, Pmw is pure Python code, and so requires no C compiler or tools to
install. To view its widgets and the corresponding code you use to construct them,
run the demos\All.py script in the Pmw distribution package. You can find Pmw at
http://pmw.sourceforge.net.
Tix
Tix is a collection of more than 40 advanced widgets, originally written for
Tcl/Tk but now available for use in Python/tkinter programs. This package is now
a Python standard library module, called tkinter.tix. Like Tk, the underlying Tix
library is also shipped today with Python on Windows. In other words, on Win-
dows, if you install Python, you also have Tix as a preinstalled library of additional
widgets.
Tix includes many of the same devices as Pmw, including spin boxes, trees, tabbed
notebooks, balloon help pop ups, paned windows, and much more. See the Python
library manual’s entry for the Tix module for more details. For a quick look at its
widgets, as well as the Python source code used to program them, run the
tixwidgets.py demonstration program in the Demo\tix directory of the Python
source distribution (this directory is not installed by default on Windows and is
prone to change—you can generally find it after fetching and unpacking Python’s
source code from Python.org).
ttk
Tk themed widgets, ttk, is a relatively new widget set which attempts to separate
the code implementing a widget’s behavior from that implementing its appearance.
Widget classes handle state and callback invocation, whereas widget appearance
is managed separately by themes. Much like Tix, this extension began life sepa-
rately, but was very recently incorporated into Python’s standard library in Python
3.1, as module tkinter.ttk.
Also like Tix, this extension comes with advanced widget types, some of which are
not present in standard tkinter itself. Specifically, ttk comes with 17 widgets, 11 of
which are already present in tkinter and are meant as replacements for some of
tkinter’s standard widgets, and 6 of which are new—Combobox, Notebook, Pro-
gressbar, Separator, Sizegrip and Treeview. In a nutshell, scripts import from the
ttk module after tkinter in order to use its replacement widgets and configure style
objects possibly shared by multiple widgets, instead of configuring widgets
themselves.
As we’ll see in this chapter, it’s possible to provide a common look-and-feel for a
set of widgets with standard tkinter, by subclassing its widget classes using normal
OOP techniques (see “Customizing Widgets with Classes” on page 400). How-
ever, ttk offers additional style options and advanced widget types. For more details
tkinter Overview | 365