Message183954
When trying to load third-party themes ttk.Style.theme_names() fails to list available themes. For example if the themes from the tile-themes project are installed one can do:
>>> from tkinter import *
>>> from tkinter import ttk
>>> root=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')
>>>
This has been discussed in more detail at tkinter-discuss:
http://code.activestate.com/lists/python-tkinter-discuss/3373/
As ttk::themes is described as being part of the Public API inside ttk.tcl and is also documented in the tcl wiki at http://wiki.tcl.tk/14796 resp. http://wiki.tcl.tk/23676 it appears safe to add it to ttk.py.
Considering this I prepared a patch (against b10a9d4f08eb) that adds the following method to ttk.Style():
def themes(self, pattern=None):
'''Returns a list of theme names available. It can be passed an
argument which is used as an lsearch glob pattern while looking
for the theme names.'''
return self.tk.splitlist(self.tk.call('ttk::themes', pattern)) |
|
Date |
User |
Action |
Args |
2013-03-11 12:43:17 | klappnase | set | recipients:
+ klappnase |
2013-03-11 12:43:17 | klappnase | set | messageid: <1363005797.61.0.988966555267.issue17397@psf.upfronthosting.co.za> |
2013-03-11 12:43:17 | klappnase | link | issue17397 messages |
2013-03-11 12:43:17 | klappnase | create | |
|