]> granicus.if.org Git - python/commitdiff
Fix Tkinter sequence passing. #2906.
authorGeorg Brandl <georg@python.org>
Tue, 3 Jun 2008 10:23:15 +0000 (10:23 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 3 Jun 2008 10:23:15 +0000 (10:23 +0000)
Lib/lib-tk/Tkinter.py

index 8bd3f50f6b35e183253796737b8bc0faca293bf2..549e0738afcada52962317fceede58e356221300 100644 (file)
@@ -1054,11 +1054,17 @@ class Misc:
                 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):