Nerd For Tech
Published in

Nerd For Tech

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.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()
id: recycleview_id
data: root.data_from_dataset()
viewclass: "RecycleButton"
default_size: None, dp(60)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'

* 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.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



I am a librarian and new computer programmer creating an app with Python and Kivy to document the plants in my garden.