The Widget Construction Kit

Fredrik Lundh

 

The Widget Construction Kit (WCK) is an extension API that allows you to implement all sorts of custom widgets, in pure Python. Creating a new widget can be as simple as:

from WCK import Widget

class HelloWidget(Widget):

    def ui_handle_repair(self, draw, x0, y0, x1, y1):
        font = self.ui_font("black", "times")
        draw.text((0, 0), "hello, world!", font)

The Tkinter 3000 implementation of the WCK is designed to work with the existing Tkinter layer, as well as the upcoming Tkinter 3000 interface layer.

The WCK is based on PythonWare’s uiToolkit’s extension API, and is designed to let you run new widgets under other toolkits as well. (for example, the effnews RSS reader for Windows uses a WCK implementation built on top of Windows’ native API.)

For more information, see this page.

Most toolkits have long assumed that a fixed library of interactive components covered the vast majority of interfaces that were to be built. As a result, they have placed an emphasis on making components from the library easy to employ, while generally neglecting the issue of making it easy to create new interactive components. For example, creating a new widget in the popular Motif toolkit is very difficult. The implicit or explicit assumptions (and in some cases simply poor early design choices) made by a system, significantly limit the kinds of things that can be (easily) accomplished with it. ” — Brad Myers et al, in Past, Present and Future of User Interface Software Tools.

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