The Widget Construction Kit

Fredrik Lundh

Update 2006-12-04: The Tkinter WCK 1.1.1 maintenance release fixes a couple of critical issues when running under Python 2.5.

 

The Widget Construction Kit (WCK) is an extension API that allows you to implement all sorts of custom widgets, in pure Python.

The WCK provides true widgets written in Python, not “megawidgets” built from existing Tkinter widgets. This has a number of advantages:

  • A WCK widget is a single widget (window). You don’t need to delegate option settings, method calls, or events to subwidgets.
  • The drawing API takes Python objects, not Tcl objects. You don’t have to wait for the Tkinter layer to convert your data for you — just draw directly from the Python data structures.
  • Things like double buffering and lazy redrawing (though idletasks) are optional. If speed and responsiveness is important, you can draw directly to the window.
  • The WCK uses ordinary Python classes, and inheritance and object composition work as usual. No need to learn another object model.

The Tkinter 3000 implementation of the WCK is designed to work with the existing Tkinter layer.

Downloads #

The Tkinter 3000 WCK can be downloaded from the effbot.org downloads site (look for tkinter3000).

Documentation

The Writing Widgets in Python tutorial:

  1. Your First Widget (Writing Widgets in Python, Part 1)
  2. Creating a Button Widget (Writing Widgets in Python, Part 2)
  3. The Drawing Interface (Writing Widgets in Python, Part 3)
  4. Displaying Large Amounts of Data (Writing Widgets in Python, Part 4)
  5. In Progress: Displaying Formatted Text (Writing Widgets in Python, Part 5) (In Progress)

Reference material:

Demo Widgets (and other related material) #

In progress:

A Django site. rendered by a django application. hosted by webfaction.