How To Refresh Kivy Recycleview
You need the following method: .refresh_from_data(). Update the data within the recycleview and then refresh the recycleview. You will need to have added an id to the recycleview in your .kv file.
Update and refresh the recycleview data in the .py file:
.py class HomeScreen(Screen):def data_from_dataset(self):
# ---- format your data for recycleview here ---- #def refresh_recycleview(self): # ----- Update the recycleview data in the .kv file: ---- #
self.ids.recycleview_id.data = self.data_from_dataset()
# ---- refresh the recycleview: ---- #
Using on_pre_enter: recycleview updates every time the user enters the HomeScreen:*
on_pre_enter: self.refresh_recycleview() RecycleView:
default_size: None, dp(60)
default_size_hint: 1, None
* Just a note, refreshing every time the HomeScreen opens could cause optimization issues and you may want to update only after a data edit. My program is small and I don’t need to worry about the refresh slowing down the app’s performance.