Set_components and remove_component functions

set_components:
Currently, if you want to set the components of an existing container like a ColumnPanel, you have to do something like:

    components = self.content_panel.get_components()
    components.pop(0)
    components.pop(1)
    self.content_panel.clear()
    for c in components:
      self.content_panel.add_component(c)

Which could be wrapped in a nice function that would look like:

components = self.content_panel.get_components()
components.pop(0)
components.pop(1)
self.content_panel.set_components(components)

In a similar manner, if you just wanted to remove the item at index 0, instead of poping and updating, you could also call the remove_component function like:

self.content_panel.remove_component(0)

The correct way to remove a component from a container is:

self.content_panel.get_components()[0].remove_from_parent()
2 Likes

Iā€™d rather call:

self.content_panel.remove_component(0)

Which could have:

self.content_panel.get_components()[0].remove_from_parent()

underneath

1 Like