Skip to content Skip to sidebar Skip to footer

How To Delete All Nodes On A Tree-view In Kivy Framework

I need help in deleting all nodes in a treeview. I am working on the kivy framework in python that will list some labels. But what happens while removing node is some of the node a

Solution 1:

There are many problems in removing items from an iterable while iterating. You should first collect the items and then remove them

for node in [i for i in treeview.iterate_all_nodes()]:
       treeview.remove_node(node)

Solution 2:

You should use iterate_all_nodes instead of iterate_open_nodes as it iterates only over all the expended nodes

Solution 3:

I am using convert to list:

for i in list(treeview.iterate_all_nodes()):
    treeview.remove_node(i)

Post a Comment for "How To Delete All Nodes On A Tree-view In Kivy Framework"