[Tkinter-discuss] Detecting third-party ttk themes

Michael Lange klappnase at web.de
Fri Mar 8 23:27:25 CET 2013


Hi,

does any one know of a way to make ttk auto-detect third-party themes
(like the ones from the tile-themes project at
http://tktable.cvs.sourceforge.net/viewvc/tktable/tile-themes/ )?

Here I installed these (as I thought) properly on my system (debian
linux); "installed" means that I copied the whole tile-themes folder
to /usr/lib, and added a pkgIndex.tcl file that contains the following
two lines:

set themesdir [file join [pwd] [file dirname [info script]]]
lappend auto_path $themesdir

This works at least partially, but ttk now shows the following odd
behavior:

>>> import Tkinter, ttk
>>> root = Tkinter.Tk()
>>> s = ttk.Style()
>>> s.theme_names()
('clam', 'alt', 'default', 'classic')
>>> root.tk.call('ttk::themes')
('classic', 'default', 'clam', 'alt')
>>> s.theme_use('winxpblue')
>>> s.theme_names()
('clam', 'alt', 'default', 'winxpblue', 'classic')
>>> root.tk.call('ttk::themes')
('keramik', 'plastik', 'clam', 'winxpblue', 'alt', 'Aquativo', 'classic',
'default', 'keramik_alt')
>>> 

Apparently here ttk::themes works better than theme_names(), although for
some reason it is not in ttk.py, but both fail to find the extra themes
before one is loaded for the first time.

Has any one an idea, is there a way to change the pkgIndex.tcl file so
that ttk will find the themes automagically or isn't this possible at all?

Regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Sometimes a man will tell his bartender things he'll never tell his
doctor.
		-- Dr. Phillip Boyce, "The Menagerie" ("The Cage"),
		   stardate unknown.


More information about the Tkinter-discuss mailing list