[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

As in Part II’s Chapter 6, I’ve pulled the examples in this chapter from my own library
of Python programs that I really use. For instance, the text editor and clock GUIs that
we’ll meet here are day-to-day workhorses on my machines. Because they are written
in Python and tkinter, they work unchanged on my Windows and Linux machines,
and they should work on Macs too.


Since these are pure Python scripts, their future evolution is entirely up to their users—
once you get a handle on tkinter interfaces, changing or augmenting the behavior of
such programs by editing their Python code is a snap. Although some of these examples
are similar to commercially available programs (e.g., PyEdit is reminiscent of the Win-
dows Notepad accessory), the portability and almost infinite configurability of Python
scripts can be a decided advantage.


Examples in Other Chapters


Later in the book, we’ll meet other tkinter GUI programs that put a good face on specific
application domains. For instance, the following larger GUI examples show up in later
chapters also:


PyMailGUI
A comprehensive email client (Chapter 14)


PyForm
A (mostly external) persistent object table viewer (Chapter 17)


PyTree
A (mostly external) tree data structure viewer (Chapter 18 and Chapter 19)


PyCalc
A customizable calculator widget (Chapter 19)


Smaller examples, including FTP and file-transfer GUIs, pop up in the Internet part as
well. Most of these programs see regular action on my desktop, too. Because GUI
libraries are general-purpose tools, there are very few domains that cannot benefit from
an easy-to-use, easy-to-program, and widely portable user interface coded in Python
and tkinter.


Beyond the examples in this book, you can also find higher-level GUI toolkits for Py-
thon, such as the Pmw, Tix, and ttk packages introduced in Chapter 7. Some such
systems build upon tkinter to provide compound components such as notebook tabbed
widgets, tree views, and balloon pop-up help.


In the next part of the book, we’ll also explore programs that build user interfaces in
web browsers, instead of tkinter—a very different way of approaching the user interface
experience. Although web browser interfaces have been historically limited in func-
tionality and slowed by network latency, when combined with the rich Internet appli-
cation (RIA) toolkits mentioned at the start of Chapter 7, browser-based GUIs today


672 | Chapter 11: Complete GUI Programs

Free download pdf