Tkinter: Query system preferences colors
Donal K. Fellows
donal.k.fellows at man.ac.uk
Tue Aug 27 14:59:16 CEST 2002
> 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.
X has a (very simple) resource database[*] which allows for customization of
many aspects of widget appearance (even up to customizing the feel of some
widget sets, though that's thankfully fairly rare) and both Gnome and KDE set
the appropriate entry to indicate that selection colours should be dark cyan
given your current system configuration. (What that actually is, well, I've no
You can query what the XResourceDB contains using 'xrdb -query' at a command
prompt (or by issuing the correct X property request on the root window, but
chances are you don't want to do that.)
> 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?
Well, under the Tcl version of Tk I might use either the [option] command or
create a listbox[**] (but never map it), query the values out of it, and then
destroy the listbox again (which is really a fairly cheap operation, because Tk
doesn't actually create a window until it's needed.) I don't know how these
translate into Python, but there must be a way to do it.
[* The name is a misnomer, but we're stuck with it. Blame the X Consortium. ]
[** Ideally with the same name as the window you create in the end, but it
usually doesn't make any difference. ]
Donal K. Fellows http://www.cs.man.ac.uk/~fellowsd/ donal.fellows at man.ac.uk
-- I'm curious; where does this statistic come from? Does its home, perchance,
ever see sunlight? -- Jason A Williams <jason+usenet at compsoc.man.ac.uk>
More information about the Python-list