Version 13 of How Tk compares to other GUI toolkits

Updated 2003-01-08 14:19:36

While fans of wxWindows, Qt, GTK+, and other GUI toolkits often deride Tk as "old-fashioned", a good case can be made that it's merely mature. Well into its second decade of successful application, Tk remains the most reliable cross-platform GUI toolkit, besting even Java's AWT in its effective coverage. Beginners also find it easier to start with Tk than any other system, with the possible exceptions of rather hermetic and platform-specific technologies, as well as members of the *Card family.

Why has Tk aged so gracefully? It enjoys several specific technical advantages, discussed below. At a higher level, it seems increasingly likely that Tk is better off for being object-based, but not object-oriented. [Explain. Todd Coram makes the point that OO limits tagging to clumsy static kinds based on RTTI and multiple subclassing--yuck. Maybe we can get Todd to write more.]

  • text and canvas are powerhouses.
  • tags are incredibly effective. The real question here is why no other toolkit has adopted tags to such good effect.

A big difference between Tk and Java's AWT/Swing is that Java provides not just a set of widgets, but also the entire infrastructure for creating new widgets, drawing graphics (manipulating individual pixels), etc. This means Java is very, very complicated, but allows you to create new widgets without needing to code in C. Tk, on the other hand, will usually require you to code in C to create an entirely novel widget' (but, it is actually quite rare that this is needed, and this is possibly why Tk is so much easier to use -- many, many so-called 'new widgets' can be implemented simply as mega-widgets, without any C).


ulis, 2002-01-08

It is possible -and easy- to write some megawidgets entirely with Tcl and Tk. An example is Hugelist [L1 ] which implements a list box that can handle more than 1,000,000 items without CPU or memory penalties.

For how this is possible, see: Mass-widget.


Yes, ulis, that's what the previous contributor said - that megawidgets can be written in Tcl/Tk. But that to create unique new widgets , one needs to go to C code because Tcl does not, at the script level, exposure APIs for generating the appropriate X transactions.


Category GUI