Tk and themes

Start with this [L1 ] comp.lang.tcl discussion. ---

Ok, I'll start with the obvious question - what are themes?

I've seen some packages where they appear to be a way of unifying colors and patterns in GUIs. Is this what they are? Is it just a grouping of "skins"? (Maybe we should define skins.) Is there a hierarchy where skins are the individual layers and themes group them?

And how do they interact with tools that have their own (very bizarre) controls over look and feel. For example, the RealAudio player lets you change the SHAPE of the user interface in radically weird ways.


I would hazard a guess that themes mean different things to different applications.

For instance, I have seen cases where it meant a group of icons, sound files, colors, shapes of widgets, etc.

Other people seem to use it in much smaller terms, as only a set of specific colors to be used in a GUI.


I think of themes for Tk as options on steroids. Not only can they group static look and feel choices together (like colors and background), but they can provide a dynamic interface. For example, a background that contains a moving picture could be specified as -bg motionPic where moticPic is some function that interfaces with -bg in some standard way. - TFW


A different solution to some of the root problems appears in [L2 ].


Beyond color choices, theme support can also mean drawing widgets differently, such as whether checkbuttons should be boxes with a checkmark when selected, MS-Windows-style, or raised and sunken as in Motif. (See, for example, KDE, where the theme selection can make widgets resemble those of Motif, NeXTstep, BeOS, MS Windows, and MacOS, among others.)

If changing the widget styles in Tk apps to match those of the windowing environment is what "themes" means, then solving the problem would mean using native widgets in Tk.

If what we mean instead is allowing the application to change its own widget appearance, as is popular in media players and chat clients (these are often called "skins"), a pure-Tk solution might be practical. Megawidgets, probably based on canvases, could emulate the built-in Tk widgets with a new look. The key thing needed for this to work is a standard way for the megawidgets to represent their state information, so that when a theme is replaced with another, the state will move transparently to the new widgets. Efficiency will probably be an issue as well, of course.


See also Themes.