I am trying to overwrite a child within a parent in the treeview table. A method which I have tried is to delete and insert the new child row but after a running the code I get the error:
_tkinter.TclError: Item I003 I004 I005 I006 not found
Deleting and inserting new children works about 5 times before I get this error. From what I can figure, once all the children have been added and deleted once I get the error above. It is like the iid isn't reset once they are deleted.
I need to either select a specific child and overwrite it or delete a child and insert a new one in its place..
This is some of my code where I am getting the children within the selected tab, deleting them and inserting a new one.
tree_select = tree.focus() clear_tree_children = tree.get_children(tree_select) clear_tree_children = tree.get_children(tree_select) if len(clear_tree_children) > 0: for child in clear_tree_children: tree.delete(clear_tree_children) print(child) if tree_phys.get() == 1: disPhys = ("", "", "", "", "", "Physical Disability") tree.insert(parent=tree_select, index=END, values=disPhys)
Has anyone got any ideas or other methods on how I can resolve this?