[Python-checkins] r62941 - sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
guilherme.polo
python-checkins at python.org
Fri May 9 17:14:25 CEST 2008
Author: guilherme.polo
Date: Fri May 9 17:14:25 2008
New Revision: 62941
Log:
Added support for the vsapi element factory, available in Tk 8.6 under Windows XP and Vista.
Modified:
sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
Modified: sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py (original)
+++ sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py Fri May 9 17:14:25 2008
@@ -332,13 +332,25 @@
def element_create(self, elementname, etype, *args, **kw):
"""Create a new element in the current theme of given etype."""
spec = None
- if etype == "image": # define an element based on an image
- # first arg should be the default image name
- iname = args[0]
- # next args, if any, are statespec/value pairs which is almost
- # a mapdict, but we just need the value
- imagespec = _format_mapdict({None: args[1:]})[1]
- spec = "%s %s" % (iname, imagespec)
+
+ if etype in ("image", "vsapi"):
+ if etype == "image": # define an element based on an image
+ # first arg should be the default image name
+ iname = args[0]
+ # next args, if any, are statespec/value pairs which is almost
+ # a mapdict, but we just need the value
+ imagespec = _format_mapdict({None: args[1:]})[1]
+ spec = "%s %s" % (iname, imagespec)
+
+ else:
+ # define an element whose visual appearance is drawn using the
+ # Microsoft Visual Styles API which is responsible for the
+ # themed styles on Windows XP and Vista.
+ # Availability: Tk 8.6, Windows XP and Vista.
+ className, partId = args[:2]
+ statemap = _format_mapdict({None: args[2:]})[1]
+ spec = "%s %s %s" % (className, partId, statemap)
+
opts = _format_optdict(kw)
elif etype == "from": # clone an element
More information about the Python-checkins
mailing list