Tkinter: Query system preferences colors

Jeff Hobbs JeffH at
Mon Aug 26 22:56:21 CEST 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:
with a nice tutorial on it's use (Tcl-oriented) at:

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     
        Tcl Support and Productivity Solutions
 Join us in Sept. for Tcl'2002:

More information about the Python-list mailing list