Python and Tkinter Programming
Author: John E. Grayson
Price: $49.95 US
Reviewer: Phil Hughes
Let's start with the conclusion: if you intend to work with Tkinter, buy this book. If you need to do graphical programming in Python but don't know what tools to use, buy this book. Now that the hard part of the review is done, let me give you a little background on my Tk experiences, and then get on to the details of the book.
About five years ago, armed with John Osterhout's book, Tcl and the TK Toolkit I started to play with Tcl and Tk. While I appreciated how you could toss together something very quickly, I was also very frustrated by Tcl. It just didn't feel like a real programming language. There was always the need for a “trick” to accomplish what I wanted. Because of this bad feeling, I never did much with Tcl and Tk.
Last year, when I interviewed Guido van Rossum, I asked him about toolkits for doing graphical programming in Python, and he recommended Tkinter. He also pointed out that the current problem was a lack of good documentation. Python and Tkinter has addressed that problem, and done a fine job as well.
The book assumes the reader has a basic knowledge of Python, but requires no knowledge of Tcl or Tk. The first part, only 28 pages, is a quick review of Python, an intro to Tkinter and a sample application. Thus, by page 28, you will be convinced that you, too, could write a calculator or two. Even in this introductory chapter, the author does an excellent job of discussing the various sections of the code.
The next part, titled “Displays”, goes on for close to 300 pages. This is the meat of the book, covering all the things you will need to build your application. First, widgets are covered, including Pmw (Python MegaWidgets) and then geometry managers. By the end of these two chapters, you should be pretty comfortable putting up any sort of widget you want and getting the screen organized.
Each concept is presented with some explanatory text, some code and a screen shot. The code is on track for teaching you the next thing you need to know, rather than being just a book of sample code. Part of the credit goes to Python itself, where you can write something useful in a few lines, but the author has done a good job of breaking up the material so that a concept can be presented in only a few pages.
The next chapter, titled “Using Classes, Composites and Special Widgets”, gets you seriously using structured programming techniques to develop your application. While this is a little scary for those of us who grew up on FORTRAN and moved to C, it is well worth embracing if you want to be a good Python programmer.
The next four chapters take you through drawing all sorts of objects. First there are “Dialogs and Forms”, where you finish up with a really fancy calculator. Next is “panels and Machines”, where you learn how to do very complex graphics models. A digital multimeter complete with rotary selector switch is one such example. The next two chapters cover more free-form drawing and finally charts and graphs. The part ends with a short chapter on the window manager.
Part three, titled “Putting it All Together...”, is a catch-all for the other things you need to know. This includes extending Python, debugging and issues of performance and style. The part ends with a chapter on distributing Tkinter applications.
The remainder of the book, over 250 pages, consists of appendices. This seems to be the tradition for most Python books. It makes sense, due to the lack of printed reference documentation on Python.
The first appendix is called “Mapping Tk to Tkinter”. If you have an existing application in Tk that you want to port, this is where you will find all the answers. It can also provide some help if you are familiar with Osterhout's book and want a quick translation guide.
Appendix B is a Tkinter reference. The reference includes descriptions of the classes, along with detailed descriptions of all options. When appropriate, graphics are also included.
Appendix C is a reference on Python megawidgets. Like the previous appendix, the descriptions are detailed and graphics are included when needed.
Appendix D covers building and installing Python and Tkinter. Information is included for UNIX and MS-Windows, with a brief mention of MacOS.
The appendices end with three short sections: Events and keysyms, Cursors and References. While each appendix is very brief, it covers important topics.
The book ends with a comprehensive index. As I said in the beginning, if you are going to work with Tkinter, buy this book. I'm not saying this because it is the only book out there. It is well organized, easy to read and offers a great tutorial combined with a comprehensive reference.
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
|Non-Linux FOSS: Seashore||May 10, 2013|
|Trying to Tame the Tablet||May 08, 2013|
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- New Products
- RSS Feeds
- New Products
- This is the easiest tutorial
6 hours 4 min ago
- Ahh, the Koolaid.
11 hours 43 min ago
- git-annex assistant
17 hours 42 min ago
- direct cable connection
18 hours 5 min ago
- Agreed on AirDroid. With my
18 hours 15 min ago
- I just learned this
18 hours 19 min ago
18 hours 49 min ago
- not living upto the mobile revolution
21 hours 41 min ago
- Deceptive Advertising and
22 hours 16 min ago
- Let\'s declare that you have
22 hours 17 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.