Which GUI?

Fredrik Lundh effbot at telia.com
Fri Feb 18 15:15:42 CET 2000

Moshe Zadka <moshez at math.huji.ac.il> wrote:
> > I think I'll make another point 'can be subclassed' in my comparison.
> Why? In Python, subclassing is much less important then in other OO
> languages. For example, while widgets in Tkinter can be subclassed, the
> official effbotic advice is not to do so (and, I must say, I agree).

Tkinter widgets should be treated as components, not
arbitrary classes.

but frankly, the whole "subclassability" discussion is a
red herring.

there is one *major* difference between Tkinter and the
other toolkits: there is (currently) no direct access to the
underlying drawing API in Tkinter.  while you can capture
the "expose" event, you cannot do much about it.

this is intentional: when Tk(inter) was designed, scripting
languages were simply too slow to do all the drawing them-
selves, so the Tk designers worked hard on power widgets
like the Text and Canvas.

(the usual way of creating custom widgets is to combine
existing widgets into compound widgets; also called mega
widgets.  in addition to Pmw, there are lots of good mega
widget libraries over in Tcl land.  using them from Python
isn't that hard, really).


the drawing API issue can be fixed, of course.  we've done
that in "uiToolkit for Tkinter", for example.  and people are
working on similar stuff over in Tcl land.

(and now that we have faster computers and faster inter-
preters, it actually makes some sense ;-).


btw, I just looked at the wxPython tutorial.

every single example in that tutorial can be written in
Tkinter, using about 50% as much Python code.  and
things like layout management and event handling looks
embarrasingly primitive compared to Tkinter.

methinks wxPython is superior to Tkinter in pretty much
the same way as languages with braces are superior to
languages using indentation...


More information about the Python-list mailing list