This is probably the wrong way of going about this completely, so I am open to other suggestions. I am trying to change the background of a button in another class from a button press. The button .kv is here:
Button:
root: 'landing_sc'
id: filebutton
size: 150, 150
size_hint: None, None
background_normal: 'folder.png'
background_down: 'opacity.png'
pos_hint: {'x': 0.11, 'top': .7}
on_release:
root.manager.transition = FadeTransition()
root.manager.transition.duration = 1.5
root.IfFolder()
root.ChangeToSlide()
app.switch.change()
And here is the app class it is referring to:
class MySubApp(App):
def switch(self):
change = LandingScreen()
def build(self):
return MyScreenManager()
And lastly here are the methods that I am trying to use in the LandingScreen class to change the background of a button there:
class LandingScreen(Screen):
def __init__(self, **kwargs):
super(LandingScreen, self).__init__(**kwargs)
self.buttons = [] # add references to all buttons here
Clock.schedule_once(self._finish_init)
def callfun(self, *args):
self.ChangePic()
def ChangePic(self, *args):
self.buttons[1].background_normal = 'folder.png'
This seems like a massive work around that isn't working anyways. Is there a simpler way to change the attribute of a button in another class on_release? Thanks.