Refresh a widget on button press kivy

Viewed 544

I have a kivy widget thats value updates during runtime which also change the number of labels and buttons in it since I build it in a for loop in python.

I call a method inside the init class to get the data needed to build it at start. However I want to update that Screen with the press of a button, basically refresh the widget since if the app was to boot up again the page would be different.

I tried:

self.but1.bind(on_press = lambda x:  self.parent.parent.parent.parent.parent.submit_all.rev.canvas.ask_update())

I thought this could maybe refresh my widget however this has no affect, even tho I recieve no error.

-The class I need to refresh is called ReviewLayout with the id 'rev'

TLDR; I want a to assign a method to the a button(on_press) that rebuilds the widget like the app was freshly launched.

1 Answers

I solved this by putting what I normally put in my init method all in another method and called that method on_press!

Related