Author: Mark Roseman
Publisher: Amazon Digital Services
Aimed at: Intermediate developers
Pros: Engaging writing and explanations; good screenshots; decent code
Cons: Gets dry by the end; some of the examples are incomplete or confusing
Reviewed by: Michael Driscoll
If you're interested in a GUI toolkit for Python, there's a new book on Tkinter.
I’ve been interested in learning about the Tkinter GUI toolkit for some time. This book, which is in mobi format for the Kindle, delivers the goods and even talks about some new developments in the kit that can make Tkinter look good instead of boring and out-dated.
Chapters 1 and 2 are introductory and give some background information on the project. Chapter 3 is just about installing Tkinter. It makes a big deal about the new ttk part of Tkinter and how it’s only available in Python 2.7 and 3.x. It should be noted that after mentioning 2.7 once, the author acts like ttk is only available for 3.x, which is confusing and erroneous. You can actually download it for versions before 2.7, but it comes with 2.7 by default (on Windows anyway).
Once it has got past installation, Chapters 4 and 5 cover introductory Tkinter concepts. Chapters 6 and 8 are widget related with 7 talking about the Grid Geometry Manager. Chapter 9 covers menus; 10 goes over Windows and Dialogs; 11 is organizational (notebooks, paned windows, etc); 12 is on Fonts, Colors and Images. Chapters 13-15 cover big widgets: the Canvas, Text, and Tree widgets respectively. The last chapter, 16, talks about theming your application.
As I already mentioned, this book is written in an engaging manner. I had heard that you could make Tkinter look good, but the new stuff in Tk 8.5+ (included in Python 2.7+) makes it sound a lot easier to make your applications look good. The ttk widgets are themed in such a way that they look native or close to it and, because of the new theming capabilities, it sounds like you can actually theme it fairly easy.
The bad things I noticed are a few instances where there are PYTHONTODO statements in the text. I assume the author meant to write more at those spots and just forgot to remove those. There’s a part in Chapter 6 about ComboBoxes that sounds like you’ll be able to associate data with the items in the list. The author states that he’ll discuss it later on in the Listbox section, but it turns out that Tkinter doesn’t provide a way to do this at all. You have to come up with your own way and while the author describes some ideas, he doesn’t demonstrate them.
Some of the ways you’re supposed to set Tkinter settings were unclear and written rather oddly, usually something like this: “step ?amount?”. I’m not really sure if the question marks are required or not, but I’m guessing not. Usually when settings were mentioned, there were no examples to go with them to see how they worked. After reading all this and seeing some of the odd ways you configure Tkinter widgets or instantiate them, I continue to think that it’s pretty unintuitive and inconsistent.
On the other hand, I thought the book covered a lot of good information in a short amount of time. I feel inspired to try Tkinter again just to see what it can do. My verdict? If you want to learn the new stuff about ttk, this book makes sense. There’s nothing on the market that I’m aware of that covers this information besides the official documentation. Just note that there are very few full examples and the theme chapter never actually shows how to create your own theme, it just gives you enough information to do it. So if you’re a new Python GUI developer and you want to use Tkinter, then this is probably the book for you.