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

index e1a7629e3e5f2eb2839f5a9ef28de4e8e475cb5b..0ae81e0f2d96100268f5b6fca04cad20c0747bd7 100644 (file)
@@ -1056,11 +1056,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):