Is it possible to get all of the children of a Tkinter widget, then get the children's children etc.?
Basically I want all of the widgets within one entire window.
Edit : I found a solution utilizing Bryan's line :
def all_children (wid) :
_list = wid.winfo_children()
for item in _list :
if item.winfo_children() :
_list.extend(item.winfo_children())
return _list
Ttk Widgets Ttk comes with 18 widgets, twelve of which already existed in tkinter: Button , Checkbutton , Entry , Frame , Label , LabelFrame , Menubutton , PanedWindow , Radiobutton , Scale , Scrollbar , and Spinbox . The other six are new: Combobox , Notebook , Progressbar , Separator , Sizegrip and Treeview .
Sometimes, we need to change or modify the focus of any widget in the application which can be achieved by using the focus_set() method. This method sets the default focus for any widget and makes it active till the execution of the program.
The pack() fill option is used to make a widget fill the entire frame. The pack() expand option is used to expand the widget if the user expands the frame.
The method you are looking for is winfo_children.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With