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

(yzsuai) #1

CHAPTER 11


Complete GUI Programs


“Python, Open Source, and Camaros”


This chapter concludes our look at building GUIs with Python and its standard tkinter
library, by presenting a collection of realistic GUI programs. In the preceding four
chapters, we met all the basics of tkinter programming. We toured the core set of
widgets—Python classes that generate devices on a computer screen and respond to
user events—and we studied a handful of advanced GUI programming techniques,
including automation tools, redirection with sockets and pipes, and threading. Here,
our focus is on putting those widgets and techniques together to create more useful
GUIs. We’ll study:
PyEdit
A text editor program
PyPhoto
A thumbnail photo viewer
PyView
An image slideshow
PyDraw
A painting program
PyClock
A graphical clock
PyToe
A simple tic-tac-toe game, just for fun*

* All of the larger examples in this book have Py a t t h e s t a r t o f t h e i r n a m e s. T h i s i s b y c o n v e n t i o n i n t h e P y t h o n
world. If you shop around at http://www.python.org, you’ll find other free software that follows this pattern
too: PyOpenGL (a Python interface to the OpenGL graphics library), PyGame (a Python game development
kit), and many more. I’m not sure who started this pattern, but it has turned out to be a more or less subtle
way to advertise programming language preferences to the rest of the open source world. Pythonistas are
nothing if not PySubtle.

671

Do


wnload from Wow! eBook <www.wowebook.com>

Free download pdf