]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 2 Aug 2008 07:20:25 +0000 (07:20 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 2 Aug 2008 07:20:25 +0000 (07:20 +0000)
Tcl command objects.

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

index b2d4e8e0925c369b6b630235ead39966149f6191..3f69baba9634dcd1219f4b1f0e7a96620e3b7d00 100644 (file)
@@ -1066,18 +1066,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 28a99e7d0cc2b7606c9e773fe5d367348498ff8f..6db54e0e02c422235a61086007d2c3c45a9fd70c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -139,6 +139,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap Tcl command objects.
+
 - Issue #3395: fix reference in test_multiprocessing to old debugInfo method
 
 - Issue #3312: Fix two crashes in sqlite3.