Next: A Simple Hello World Program
Tkinter Life Preserver
Tkinter is a Python interface to the Tk GUI toolkit. This document is
not designed to be an exhaustive tutorial on either Tk or Tkinter.
Rather, it is intended as a stop gap, providing some introductory
orientation on the system. Hopefully, it will also help to answer
programmers questions, when they need something more useful than
``read the source code.''
This manual assumes that you are familiar with
the Python programming language
and that you have access to
the Tk toolkit man
This manual is designed in two parts: the first half (roughly) covers
background material, while the second half can be taken to the
keyboard as a handy reference.
- Tkinter was written by Steen Lumholt and Guido van Rossum (the
inventor of the Python programming language).
- Tk was written by John
Ousterhout while at Berkeley, now at Sun Microsystems.
- This manual was written by Matt Conway at the University of Virginia. Many thanks
go to Tommy Burnette, Shuichi Koga, Joe Shochet, and Richard
Stoakley, for their excellent suggestions regarding the format
and content of this document. Special thanks go to Joe
Shochet for helping to produce Tkinter example programs.
- This html rendering, and some liberal editing, was
produced from a FrameMaker version by Ken Manheimer, with the
sketchy assistance of Quadralay WebWorks HTML Lite 1.5.1.
elaborated and revised the class interface descriptions, to
get them current with Tk 4.2.
When trying to answer questions of the form ``how do I do blah'', it
is often best to find out how to do "blah" in straight Tk, and then
convert this back into the corresponding Tkinter call. Steen Lumholt
has done an admirable job in keeping the correspondence between Tk and
Tkinter close, so that Python programmers can often guess at the
correct Python command by looking at the Tk documentation. This means
that in order to use Tkinter, you will have to know a little bit about
Tk. This document can't fulfill that role, so the best we can do is
point you to the best documentation that exists. Here are some
- The authors strongly suggest getting a copy of the Tk man
pages. Specifically, the man pages in the "mann" directory are most
useful. The "man3" man pages describe the C interface to the Tk
library and thus are not especially helpful for script writers.
- There is a collection of
tkinter programs that show very basic tkinter operations.
This collection is dynamic and we appreciate any suggestions you might have
for programs to include. For people who would like one-stop shopping,
the authors have made this document and the associated example files
available to Guido van Rossum for inclusion at the official Python FTP
- Addison-Wesley publishes a book called Tcl and the Tk Toolkit by
John Ousterhout (ISBN 0-201-63337-X) which is a good introduction to
Tcl and Tk for the novice. The book is not exhaustive, and for many
details, it defers to the man pages.
- Tkinter.py is a last resort for most, but can be a good place to
go when nothing else makes sense.