On Fri, 8 Mar 2013 23:27:25 +0100
Michael Lange <[email protected]> wrote:
> 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?
It is hard to find any docs a tcl-illiterate as me can use, so I made
some further experiments. First I added a third line to the tile-themes
pkgIndex.tcl file:
set themesdir [file join [pwd] [file dirname [info script]]]
lappend auto_path $themesdir
package provide tile-themes 0.6
Now I can do:
>>> 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')
>>> root.tk.call('package', 'require', 'tile-themes')
'0.6'
>>> s.theme_names()
('clam', 'alt', 'default', 'classic')
>>> root.tk.call('ttk::themes')
('keramik', 'plastik', 'clam', 'winxpblue', 'alt', 'Aquativo', 'classic',
'default', 'keramik_alt')
>>>
which apears to be a step in the right direction. But why does
theme_names() still fail to find the themes?
Then I tried some more with the pkgIndex.tcl :
set themesdir [file join [pwd] [file dirname [info script]]]
lappend auto_path $themesdir
package provide tile-themes 0.6
source [file join $themesdir plastik plastik.tcl]
and actually:
root = Tkinter.Tk()
>>> root.tk.call('package', 'require', 'tile-themes')
'0.6'
>>> s = ttk.Style()
>>> s.theme_names()
('plastik', 'clam', 'alt', 'default', 'classic')
>>>
However when trying to source the other theme files as I did with
plastik.tcl inside the pkgIndex.tcl I get strange errors:
>>> root.tk.call('package', 'require', 'tile-themes')
error reading package index file /usr/lib/tile-themes/pkgIndex.tcl: too
many nested evaluations (infinite loop?) error reading package index
file /usr/share/tcltk/tk8.3/pkgIndex.tcl: too many nested evaluations
(infinite loop?) error reading package index
file /usr/lib/tile-themes/pkgIndex.tcl: too many nested evaluations
(infinite loop?) error reading package index
file /usr/lib/tile-themes/pkgIndex.tcl: Theme Aquativo already exists
error reading package index file /usr/lib/tile-themes/pkgIndex.tcl: Theme
Aquativo already exists error reading package index
file /usr/lib/tile-themes/pkgIndex.tcl: Theme Aquativo already exists
(...)
where the amount of errors heavily depends on the order in which
the theme files are sourced.
I don't have an idea what's wrong here, but it seems like the first
solution is the best for now.
I think maybe I should file a bug report / patch to ad the missing
'ttk::themes' to ttk.py .
Regards
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
Landru! Guide us!
-- A Beta 3-oid, "The Return of the Archons", stardate
3157.4
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss