Commit f2041b8a authored by Martin v. Löwis's avatar Martin v. Löwis

Ignore widgets with unknown names in winfo_children. Fixes #518283.

2.2.2 candidate.
parent 38a89161
...@@ -605,9 +605,17 @@ class Misc: ...@@ -605,9 +605,17 @@ class Misc:
self.tk.call('winfo', 'cells', self._w)) self.tk.call('winfo', 'cells', self._w))
def winfo_children(self): def winfo_children(self):
"""Return a list of all widgets which are children of this widget.""" """Return a list of all widgets which are children of this widget."""
return map(self._nametowidget, result = []
self.tk.splitlist(self.tk.call( for child in self.tk.splitlist(
'winfo', 'children', self._w))) self.tk.call('winfo', 'children', self._w)):
try:
# Tcl sometimes returns extra windows, e.g. for
# menus; those need to be skipped
result.append(self._nametowidget(child))
except KeyError:
pass
return result
def winfo_class(self): def winfo_class(self):
"""Return window class name of this widget.""" """Return window class name of this widget."""
return self.tk.call('winfo', 'class', self._w) return self.tk.call('winfo', 'class', self._w)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment