]> granicus.if.org Git - python/commitdiff
Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 2 Aug 2008 07:21:06 +0000 (07:21 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 2 Aug 2008 07:21:06 +0000 (07:21 +0000)
Tcl command objects.
Backport of r65399.

Lib/lib-tk/Tkinter.py
Misc/NEWS

index 0ae81e0f2d96100268f5b6fca04cad20c0747bd7..6f00397650d019f2441eb3067aabb74bd45b45de 100644 (file)
@@ -1072,18 +1072,18 @@ class Misc:
     def nametowidget(self, name):
         """Return the Tkinter instance of a widget identified by
         its Tcl name NAME."""
+        name = str(name).split('.')
         w = self
-        if name[0] == '.':
+
+        if not name[0]:
             w = w._root()
             name = name[1:]
-        while name:
-            i = name.find('.')
-            if i >= 0:
-                name, tail = name[:i], name[i+1:]
-            else:
-                tail = ''
-            w = w.children[name]
-            name = tail
+
+        for n in name:
+            if not n:
+                break
+            w = w.children[n]
+
         return w
     _nametowidget = nametowidget
     def _register(self, func, subst=None, needcleanup=1):
index 153e551fedeeaf8d886c333bf1d86327035f114c..c74072e8688862f198ce7ba16a38f6efb328a821 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -74,6 +74,8 @@ Core and builtins
 Library
 -------
 
+- Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap Tcl command objects.
+
 - Issue #3339: dummy_thread.acquire() could return None which is not a valid
   return value.