Python Kivy Listview: How To Delete Selected Listitembutton?
I'm trying to learn kivy by building a simple todo-list app like suggested by Dusty Phillips, author of the book 'Creating apps in Kivy'. This is the code so far: from kivy.app imp
Solution 1:
After a lot of reading ListView API docs & examples, I finally found out myself. What we need is the selection-Property of the listadapter-Class, then we can simply call the inherited remove method of the adapter.data-ListProperty.
So for anyone interesested this is the code:
defdel_task(self, *args):
ifself.task_list.adapter.selection:
selection = self.task_list.adapter.selection[0].text
self.task_list.adapter.data.remove(selection)
self.task_list._trigger_reset_populate()
Post a Comment for "Python Kivy Listview: How To Delete Selected Listitembutton?"