Команда: tree.get_children(item=None)
. Вы можете вызвать его рекурсивно, чтобы пройти через дочерние узлы.
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
tree = ttk.Treeview(root)
a = tree.insert("", "end", text="Item",open=True)
b = tree.insert(a, "end", text="Subitem1",open=True)
tree.insert(a, "end", text="Subitem2")
for i in range(1,3):
tree.insert(b, "end", text=f"Subsubitem{i}")
tree.pack()
def get_child():
for item in tree.get_children():
for subitem in tree.get_children(item):
for subsubitem in tree.get_children(subitem):
print (subsubitem, tree.item(subsubitem)["text"])
tk.Button(root,text="click me",command=get_child).pack()
root.mainloop()