Oct-18-2021, 03:42 AM
(This post was last modified: Oct-18-2021, 03:42 AM by deanhystad.)
I get the same results if my_list is a list or a BindableList. The problem is that everything you added to the list is the same; o1 == o2 == o3. The reason they are all the same is because they are all empty lists.
If you want to remove items based on the item ID or the name, you need to override some comparison operators in BindableList. These use _name when comparing <, >. ==.
If you want to remove items based on the item ID or the name, you need to override some comparison operators in BindableList. These use _name when comparing <, >. ==.
class BindableList(Bindable, list): ITEM_APPENDED = "<<ITEM_APPENDED>>" ITEM_REMOVED = "<<ITEM_REMOVED>>" ITEM_INSERTED = "<<ITEM_INSERTED>>" def __gt__(self, other): return self._name > other._name def __lt__(self, other): return self._name < other._name def __eq__(self, other): return self._name == other._name def append(self, __object) -> None: super().append(__object) self.event_generate(BindableList.ITEM_APPENDED, __object) def remove(self, __value) -> None: super().remove(__value) self.event_generate(BindableList.ITEM_REMOVED, __value) def insert(self, __index: int, __object) -> None: super().insert(__index, __object) self.event_generate(BindableList.ITEM_INSERTED, (__index, __object))