[Python-checkins] r63916 - python/branches/release25-maint/Lib/lib-tk/Tkinter.py

georg.brandl python-checkins at python.org
Tue Jun 3 12:26:22 CEST 2008


Author: georg.brandl
Date: Tue Jun  3 12:26:21 2008
New Revision: 63916

Log:
Fix tkinter sequence passing. #2906. Backport from r63914.


Modified:
   python/branches/release25-maint/Lib/lib-tk/Tkinter.py

Modified: python/branches/release25-maint/Lib/lib-tk/Tkinter.py
==============================================================================
--- python/branches/release25-maint/Lib/lib-tk/Tkinter.py	(original)
+++ python/branches/release25-maint/Lib/lib-tk/Tkinter.py	Tue Jun  3 12:26:21 2008
@@ -1056,11 +1056,17 @@
                 if callable(v):
                     v = self._register(v)
                 elif isinstance(v, (tuple, list)):
+                    nv = []
                     for item in v:
                         if not isinstance(item, (basestring, int)):
                             break
+                        elif isinstance(item, int):
+                            nv.append('%d' % item)
+                        else:
+                            # format it to proper Tcl code if it contains space
+                            nv.append(('{%s}' if ' ' in item else '%s') % item)
                     else:
-                        v = ' '.join(map(str, v))
+                        v = ' '.join(nv)
                 res = res + ('-'+k, v)
         return res
     def nametowidget(self, name):


More information about the Python-checkins mailing list