Version 0 of How does one change the font in the wish widgets

Updated 1999-07-07 08:43:48

Purpose: to describe the alternatives one has in specifying fonts in wish widgets.

In June, 1999, Markus Pietrek wrote on news:comp.lang.tcl :

"... changing the font of the window widget (which is done with <widgetpath> configure -font "Helvetica 10") is not enough, because you have to do it for each (child) widget.

So use the option database. In the wish program, write at the very beginning

 option add *font "Helvetica 10"

(or whatever font you want).


An alternative to users hard coding fonts in scripts is to write the tk code to read resources in from files. For instance, one can use the Tk option command to read a resource file. See http://www.purl.org/NET/Tcl-FAQ/part5.html for pointers to Tk code to assist in writing applications which appear to use resources like other X applications.

As far as I Larry Virden know, no one has written a Tk package that works in a cross platform manner for this type of thing.


Be sure to see Practical Guide to Choosing Fonts here on Wiki as well.


If you're going to use the option database, my option tutorial [L1 ] is very useful reading. DKF