A tkinter command to extract the iid of all detached items from ttk.Treeview?

Is there a tkinter command to extract the item ID (iid) of all detached items in a ttk.Treeview widget?


  • There's no way to enumerate the detached items in the Treeview. You can enumerate the attached children of the root node, but that doesn't include the detached children by definition. You also can't find out whether a particular known item is attached (directly or indirectly) to the root (but might be able to infer it by a combination of the parent and children methods; detached items both have an empty parent and aren't listed in the children of the root node).

    In short, once you lose the item ID of a detached item, you've effectively leaked the item (until you destroy the widget, so it's not formally a memory leak).

    This needs a feature request to fix. It's an API omission. (I've opened a branch with an implementation.)