Perspective how to remove an item from a tree dynamicaly

Is there a way to programmatically remove an item in a tree component?
I know how to add it but not how to delete it.

To add I use the items.append

stylestring = {'classes':'TreeIcon_NoComms'}
itemstring = {'label':data["Loop_1"]["LoopName"],"expanded":bool(1),'icon':iconstring,'items':}
self.getChild("Tree").props.items[0].items.append(itemstring)

Have you tried using self.getChild("Tree").props.items[0].items.pop(index_of_item_to_remove)?

Also, you should be aware of this bug when attempting to modify something with an objectWrapper type using normal python dictionary/list methods.

1 Like

That works. Thank you.