for children in self.points_tree.get_children(): child = self.points_tree.item(children) print(child)This works perfectly for iterating through the parent children in the tree, but how do I iterate through the sub-children of each parent within the tree? I've attached an image for visual purposes.
Omg, Found the solution once again. Or at least a solution for now.
import tkinter as tk import tkinter.ttk as ttk def get_sub_children(): for children in tree.get_children(): child = tree.get_children(children) print(children, child) root = tk.Tk() btn = tk.Button(root, text='press', command=lambda: get_sub_children()) tree = ttk.Treeview(root, columns=1) tree.pack(fill='both', expand=True) btn.pack(side='top') tree.insert("", tk.END, values='1') for i in range(1, 5): for children in tree.get_children(): tree.insert(children, tk.END, values=i) root.mainloop()this seemed to do the trick for me.
Output:I001 ('I002', 'I003', 'I004', 'I005')