From: Georg Brandl <georg@python.org>
Date: Tue, 3 Jun 2008 10:23:15 +0000 (+0000)
Subject: Fix Tkinter sequence passing. #2906.
X-Git-Tag: v2.6b1~164
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ed3ed13c5c82f4b46d633cb7f61d6218d6ed320;p=python

Fix Tkinter sequence passing. #2906.
---

diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 8bd3f50f6b..549e0738af 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -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):