Tkinter: Query system preferences colors

Jeff Hobbs JeffH at ActiveState.com
Mon Aug 26 16:56:21 EDT 2002


Phlip wrote:
	...
> When I read the Tk source, it sez it is giving the list box a
> selection color of #c3c3c3.
> 
> When I query the configurations in use for this ListBox (using print
> list.configure()), it says it's using #0a5f89, which is dark cyan.
> 
> Where is Tk getting this value? I searched all over its source for
> something relevant.
> 
> How do I query a desktop configuration (under X11, Kde or Gnome, >not<
> Windows or Mac) so that list boxes I construct from canvases
> seamlessly integrate with library list boxes?

Tk will correctly read the X database to adapt various widget options to
global (I mean this in the X window manager sense) preferences.  These
are the things you would have in your ~/.Xdefaults, and querying their
effect on Tk can be seen with the option command:
	http://www.tcl.tk/man/tcl8.3/TkCmd/option.htm
with a nice tutorial on it's use (Tcl-oriented) at:
	http://www.cs.man.ac.uk/~fellowsd/tcl/option-tutorial.html

If you are finding that the core widget defaults are "magically" being
changed when you run, it is likely due to the option database.

-- 
  Jeff Hobbs                     The Tcl Guy
  Senior Developer               http://www.ActiveState.com/
        Tcl Support and Productivity Solutions
 Join us in Sept. for Tcl'2002: http://www.tcl.tk/community/tcl2002/



More information about the Python-list mailing list