Search code examples
pythontkintertreeviewttk

Can Tkinter ttk.treeview iid overflow?


I am using tkinter and specifically the ttk.treeview widget to display tuples. I do a lot of inserting and was wondering if the iid (item identifier) can overflow or how it is handled. I hypothesize that the maximum iid is 0xFFF which is equivalent to 4095 base 10 given that they are formatted as string like "I001." If they do overflow how can I reuse/delete an iid?


Solution

  • After some testing I discovered iids are not just three digit hexadecimals but can be up to five. I say up to five because in my testing I hit a memory error before I could exhaust the amount of unique iids. I was getting iids like "IEA600" before I hit memory issues.

    One memory error was "unable to realloc 3145736 bytes" when deleting just under a million children from the treeview.