| Store | Cart

Re: [Tkinter-discuss] Detecting third-party ttk themes

From: Jeff Epler <jep...@unpythonic.net>
Sun, 10 Mar 2013 20:55:46 -0500
ttk.Style.theme_names is using [ttk::style theme names].  This
enumerates the table of loaded themes only (ones that already exist in
the interpreter).

[ttk::themes] uses a different method: it searches [package names] for
loaded or available, but as far as I can tell there's no way to know
you've got the full list of [package names]!  For instance, I can get
several different combinations of values:

$ tclsh8.5
% package names
tcl::tommath Tcl
% package require xyzzy
can't find package xyzzy
% package names
http tcl::tommath ttk::theme::keramik_alt BLT opt tcltest ttk::theme::plastik BWidget msgcat tclreadline Expect ttk::theme::keramik Tcl platform Togl tile Tk
% package require ttk::theme::plastik
0.6.2
% package names
ttk::theme::classic http tcl::tommath ttk::theme::keramik_alt BLT Ttk ttk::theme::default opt tcltest ttk::theme::plastik BWidget msgcat tclreadline Expect ttk::theme::keramik ttk::theme::clam Tcl platform Togl tile ttk::theme::alt Tk

so I think the pattern would have to be:
 * do a dummy [package require impossible-package-name] to ensure that
   anything directly named in a pkgIndex.tcl gets pulled in
   (you'll either need a Tcl catch or a Python try/except around this)

 * do a [package require tile-themes] in case that package is installed
   (you'll either need a Tcl catch or a Python try/except around this)

 * and then prefer [ttk::themes] to ttk.Style().theme_names()

since I didn't observe any circumstance in which [ttk::themes] listed
fewer themes than [ttk::style theme names], I wonder whether that isn't
a candidate for a python bugreport for ttk.py.

After all these years I remain utterly bewildered at Tcl's system for
packages, particularly as compared to how straightforward Python's
are...

Jeff
_______________________________________________
Tkinter-discuss mailing list
Tkin...@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Recent Messages in this Thread
Michael Lange Mar 08, 2013 10:27 pm
Michael Lange Mar 10, 2013 02:15 pm
Jeff Epler Mar 11, 2013 01:55 am
Michael Lange Mar 11, 2013 06:30 pm
Messages in this thread