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 selected items

We can delete the selected items in a treeview widget using the .delete() method.

img

1
2
3
4
5
# Get all selected items.
selected_items = treeview_food.selection()

# Delete all the selected items.
treeview_food.delete(*selected_items)