Tkinter

Tkinter is Python's de-facto standard GUI (Graphical User Interface) package. It is a thin object-oriented layer on top of Tcl/Tk.

See Also

Tcl/Tk--|direct translation|-->Tkinter
TkDocs
Shows how to use Tk from Tcl, Python, Perl, and Ruby.
How Tkinter can exploit Tcl extensions
Thinking in tkinter ,by Stephen Ferg]
Tkinter Summary ,Russell Owen ,updated 2006-10-20
[1 ] (alternates: Tkinter Folkore ) ,Russell Owen
Tk 8.5 is better than wxWidgets on Windows ,Biospud ,2009-08-22

Documentation

official reference
official wiki
Python and Tkinter Programming , a book by John E. Grayson ,2000

Tools

Tixapps (look in the Python directory)
Gustavo Cordero has worked on a recipe to make some Tk extensions--tkhtml and tktable--available to Tkinter developers.
Tkinspect
also see below
Bwidget for Tkinter
last updated in 2005

Description

Tkinter is part of the standard Python distribution.

Implemented through Tcl scripting interface as much as possible, and the C API in bits. Note that, in the mid-'90s, David Ascher wrote [2 ], a C Python binding based on Brian Warkentine's earlier Rivet work. Trinket might provide details, or at least fossils.

Interesting things to note about Tkinter: the windows all have numeric names (eg: .123456789) and the Python callbacks are created as Tcl commands with numeric names. This means that Tkinspect (unsurprisingly) cannot inspect the Python code used for the callback. You can however manipulate the window properties and the Tcl environment.

Tkinspect

PT 2003-07-02: Tkinspect can be used to examine and manipulate Tkinter applications. Under windows the Python app needs a little help (as send isn't available for Windows). You can send enable a Tkinter application by including the following:

root.tk.eval('package require dde; dde servername Tkinter')

which sets up the application as a Tcl DDE server. Tkinspect can connect to this now.

In fact, here is a sample application for good measure (modified from some other example):

from Tkinter import *

class App:

    def __init__(self, master):

        frame = Frame(master)
        frame.pack()

        self.button = Button(frame, text="Exit", command=frame.quit)
        self.button.pack(side=LEFT)

        self.hi = Button(frame, text="Speak", command=self.say_hi)
        self.hi.pack(side=LEFT)

    def say_hi(self):
        print "Hello, World!"

root = Tk()
root.tk.eval('package require dde; dde servername Tkinter')
app = App(root)
root.mainloop()