ttk.Treeview – Delete all items

We can delete all items in a treeview widget, regardless if they’re selected or not.

img

1
2
3
4
5
# Get a tuple of all root-level item iid's
all_root_items = treeview_food.get_children()

# Delete all root level items, which will automatically delete all their children too.
treeview_food.delete(*all_root_items)