summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-08-02 07:20:25 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-08-02 07:20:25 (GMT)
commitaabf404ecc06f1ddbb4c003508dff78c7ac06012 (patch)
treeb5f62128570cf6deefaac735aa1a83fc15ab9fd8
parent97b1fb6a98809e82a76953522bd3d334cbbd4260 (diff)
downloadcpython-aabf404ecc06f1ddbb4c003508dff78c7ac06012.zip
cpython-aabf404ecc06f1ddbb4c003508dff78c7ac06012.tar.gz
cpython-aabf404ecc06f1ddbb4c003508dff78c7ac06012.tar.bz2
Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap
Tcl command objects.
-rw-r--r--Lib/lib-tk/Tkinter.py18
-rw-r--r--Misc/NEWS2
2 files changed, 11 insertions, 9 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index b2d4e8e..3f69bab 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -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):
diff --git a/Misc/NEWS b/Misc/NEWS
index 28a99e7..6db54e0 100644
--- 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.