[Python-checkins] r63914 - python/trunk/Lib/lib-tk/Tkinter.py

georg.brandl python-checkins at python.org
Tue Jun 3 12:23:15 CEST 2008


Author: georg.brandl
Date: Tue Jun  3 12:23:15 2008
New Revision: 63914

Log:
Fix Tkinter sequence passing. #2906.


Modified:
   python/trunk/Lib/lib-tk/Tkinter.py

Modified: python/trunk/Lib/lib-tk/Tkinter.py
==============================================================================
--- python/trunk/Lib/lib-tk/Tkinter.py	(original)
+++ python/trunk/Lib/lib-tk/Tkinter.py	Tue Jun  3 12:23:15 2008
@@ -1054,11 +1054,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