This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author klappnase
Recipients klappnase
Date 2013-03-11.12:43:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1363005797.61.0.988966555267.issue17397@psf.upfronthosting.co.za>
In-reply-to
Content
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))
History
Date User Action Args
2013-03-11 12:43:17klappnasesetrecipients: + klappnase
2013-03-11 12:43:17klappnasesetmessageid: <1363005797.61.0.988966555267.issue17397@psf.upfronthosting.co.za>
2013-03-11 12:43:17klappnaselinkissue17397 messages
2013-03-11 12:43:17klappnasecreate