can sometimes approach the utility of traditional GUIs, albeit at substantial cost in
software complexity and dependencies.
Especially for highly interactive and nontrivial interfaces, though, standalone/desktop
tkinter GUIs can be an indispensable feature of almost any Python program you write.
The programs in this chapter underscore just how far Python and tkinter can take you.
This Chapter’s Strategy
As for all case-study chapters in this text, this one is largely a learn-by-example exercise;
most of the programs here are listed with minimal details. Along the way, I’ll highlight
salient points and underscore new tkinter features that examples introduce, but I’ll also
assume that you will study the listed source code and its comments for more informa-
tion. Once we reach the level of complexity demonstrated by programs here, Python’s
readability becomes a substantial advantage for programmers (and writers of books).
All of this book’s GUI examples are available in source code form in the book’s exam-
ples distribution described in the Preface. Because I’ve already shown the interfaces
these scripts employ, this section consists mostly of screenshots, program listings, and
a few brief words describing some of the most important aspects of these programs. In
other words, this is a self-study section: read the source, run the examples on your own
computer, and refer to the previous chapters for further details on the code listed here.
Some of these programs may also be accompanied in the book examples distribution
by alternative or experimental implementations not listed here; see the distribution for
extra code examples.
Finally, I want to remind you that all of the larger programs listed in the previous
sections can be run from the PyDemos and PyGadgets launcher bar GUIs that we met
at the end of Chapter 10. Although I will try hard to capture some of their behavior in
screenshots here, GUIs are event-driven systems by nature, and there is nothing quite
like running one live to sample the flavor of its user interactions. Because of that, the
launcher bars are really a supplement to the material in this chapter. They should run
on most platforms and are designed to be easy to start (see the top-level README-
PP4E.txt file for hints). You should go there and start clicking things immediately if
you haven’t done so already.
Open Source Software and Camaros
Some of the GUI programs in this chapter, as well as the rest of the book, are analogous
to utilities found on commonly used operating systems like Windows. For instance,
we’ll meet calculators, text editors, image viewers, clocks, email clients, and more.
Unlike most utilities, though, these programs are portable—because they are written
in Python with tkinter, they will work on all major platforms (Windows, Unix/Linux,
and Macs). Perhaps more important, because their source code is available, they can
be scripted—you can change their appearance or function however you like, just by
writing or modifying a little Python code.
“Python, Open Source, and Camaros”| 673