NOTE THAT THIS PAGE IS STILL UNDER DEVELOPMENT.
A NUMBER OF THE LINKS DO NOT YET WORK.
— Stephen Ferg, 2011-10-26
I've been trying to teach myself Tkinter out of various books, and I'm finding it more difficult than I think it should be.
The problem is that the authors of the books want to rush into telling me about all of the widgets in the Tkinter toolbox, but never really pause to explain basic concepts. They don't explain how to "think in Tkinter". So I thought that I would try to write the kind of book that I wanted to read. Or at least the sketch of such a book.
Thinking in Tkinter consists of a few short programs that begin to explain how to think in Tkinter. In them, I don't attempt to catalog all of the types of widgets, attributes, and methods that are available in Tkinter. I just try to get started down the road of understanding some basic Tkinter concepts.
These programs do not attempt to provide a comprehensive introduction to all aspects of Tkinter programming. For that, I refer you to Frederik Lundh's An Introduction to Tkinter, John Shipman's Tkinter reference, and the other useful references at the bottom of this page.
Above all, I must emphasize that Practical Programming in Tcl and Tk by Brent Welch is absolutely essential for working with Tk and Tkinter. Get this book!
Note that you should not run these programs under IDLE. IDLE is itself a Tkinter application, with its own "mainloop" that will conflict with the mainloop in these programs. If you really want to view and run these programs using IDLE, then -- for each program -- you should comment out the "mainloop" statement in the program before running it.
This material has been substantially improved by feedback from folks on comp.lang.python. A big "Thank you!" to Alan Colburn, Jeff Epler, Greg Ewing, Tom Good, Steve Holden, Joseph Knapka, Gerrit Muller, Russell Owen, and Chad Netzer. Thanks to Terry Carroll for catching and reporting typos.
Thinking in Tkinter consists of a set of Python programs. Each program contains a long documentation string with text that explains certain concepts, followed by executable code that illustrates the concepts.
You can download a ZIP file containing all of the programs, plus a driver file, by downloading thinking_in_tkinter.zip.
This zip file contains the Thinking in Tkinter Python files, plus a driver program called thinking.py and a batch file called thinking.bat. To install these files, simply unzip the zip file into a directory (i.e. folder) of your choice. Once the have been unzipped, make that directory your current directory. You can then start the programs from the command prompt by entering:
python thinking.py If you are in a Windows environment, you can start thinking.bat from the command prompt simply by entering: thinking at the command-line prompt.
You can look at the individual programs online by clicking on the following links
Most Tkinter documentation is fairly old, but since Tkinter hasn't evolved much has been stable for a long time, even old Tkinter documentation is still useful.
Tkinter
Tcl and Tk
Event-Driven Programming: Introduction, Tutorial, History is my attempt to explain the basics of event-driven programming
EasyGui can help you easily put a simple GUI front-end on your Python application.