summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-08-02 07:23:15 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-08-02 07:23:15 (GMT)
commitcdfae162c9d43f8d398cdb857f56c138579ef932 (patch)
treea9e47bf578e6cb92bd95fb5187fd0aa4f94c732e
parent59b4b170edd2e62f0b2f427ebeabc0d0ae0d0219 (diff)
downloadcpython-cdfae162c9d43f8d398cdb857f56c138579ef932.zip
cpython-cdfae162c9d43f8d398cdb857f56c138579ef932.tar.gz
cpython-cdfae162c9d43f8d398cdb857f56c138579ef932.tar.bz2
Merged revisions 65399 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r65399 | martin.v.loewis | 2008-08-02 09:20:25 +0200 (Sa, 02 Aug 2008) | 3 lines Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap Tcl command objects. ........
-rw-r--r--Lib/tkinter/__init__.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index dbb632b..08c5823 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -1063,18 +1063,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):