mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Ignore widgets with unknown names in winfo_children. Fixes #518283.
2.2.2 candidate.
This commit is contained in:
parent
38a8916134
commit
f2041b8aa6
1 changed files with 11 additions and 3 deletions
|
@ -605,9 +605,17 @@ class Misc:
|
|||
self.tk.call('winfo', 'cells', self._w))
|
||||
def winfo_children(self):
|
||||
"""Return a list of all widgets which are children of this widget."""
|
||||
return map(self._nametowidget,
|
||||
self.tk.splitlist(self.tk.call(
|
||||
'winfo', 'children', self._w)))
|
||||
result = []
|
||||
for child in self.tk.splitlist(
|
||||
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):
|
||||
"""Return window class name of this widget."""
|
||||
return self.tk.call('winfo', 'class', self._w)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue