How to change text on button with pressing of different button without use of 'self' instance

Viewed 37

I need your help on this.

class SwimMenu(Screen):
 
    wDiscard = "discard"
    def falsify1(self):
        global really
        really = False
        self.parent.remove_widget(self)
        #here I need to change text on discard button


reallyButton1 = Button(pos=(0, 0.1), size_hint=(1, 0.9), text="", background_color=(0, 0, 0, 0))
reallyButton1.bind(on_release=falsify1)

There is my .kv file:

<SwimMenu>:
name: "swim"
FloatLayout:
    Button:
        id: discard
        size_hint: 0.2, 0.1
        pos_hint: {"x":0.8, "y":0.9}
        text: root.wDiscard
        on_release:
            root.remove()

Basically what I want to do is to change text on discard button created in .kv file after pressing really button which is defined in python file. I have solved it with falsify1() function where I am also doing some other stuff, but I couldn't find a way to change text on discard button as self instance here is referring to the button itself, which I figured might be the problem. Every solution I have googled required self, which doesn't work for me.

Do you have any idea how to solve this?

0 Answers
Related