I don't have ads on this website.
Donations help keep this site going.

If you find tkinter-snippets.com useful, please donate any amount you feel comfortable with.
Visit https://ko-fi.com/jobinpy to donate. Thank you!

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)