http://purl.org/tcl/home/man/tcl8.4/TkCmd/option.htm ---- The Tk command '''option''' acts on the "[option database]". ---- [Chris Nelson] notes: > I've changed to: > > # Why do these affect selection? > option add *Entry.background red widgetDefault > option add *Entry.foreground blue widgetDefault > > entry .e > pack .e > > # Why is this only when the button is active? > option add *Button.background red widgetDefault > option add *Button.foreground green widgetDefault > > button .b -text Exit -command exit > pack .b > > And now the options seem to have no effect. Based on a clue from Jeff in another conversation, I found that setting the priority to startupFile, instead of widgetDefault, was enough to get this to work. It seems Solaris' CDE does some funky color stuff. ---- Jeff replies: More accurately, Solaris sets the equivalent of: *foreground and *background in the X defaults. Very lame way to control L&F, but that's what they chose. Those wanting to get around this can also see the solutions in the Tk Usage FAQ: http://www.purl.org/net/hobbs/tcl/faqs/tk/ (aka http://tcl.sourceforge.net/faqs/tk/ ) ''[DKF] notes:'' For toolkits based on Xt (such as Athena, Motif and CDE) the above settings are not quite so lame. That's because the rule there is to choose the "most specific" option, and therefore those options listed above are overridden by virtually everything. It's just that Tk's option-db handling code does things ''quite'' differently... [LV] So why does Tk do things so differently? Why not do them in a way that is compatible with Xt, at least on platforms where Xt is used? And is there a way to code option calls so that one gets the equivalent of the Xt method of resolving resources - that is, to choose the most specific resource database entry? ---- [Example of using option to allow various levels of configurability] See also http://www.man.ac.uk/~zzcgudf/tcl/option-tutorial.html and http://www.changhai.org/contents/technology/programming/tcltricks.html . ---- I'd like to find out what the default font for a widget is without creating the widget. It seems like '''option get''' would be the way to do this but I can't figure out exactly what I need to pass. I'm trying stuff like option get . *.label.font {} and I get nothing. ---- [Tk syntax help] - [Arts and crafts of Tcl-Tk programming] - [Category Command]