0

How do I change the widget argument at the click of a button? That is for example there is a button

MDRaisedButton:
        id: but
        pos: (150,150)
        text: 'Старый текст'
        on_press: app.func()

How can I replace the text argument with, for example, 'New text' by clicking the same button? What do I need to write in the func function to make it work?

Mirai
  • 115
  • 2
  • 16

1 Answers1

0
MDRaisedButton:
    id: but
    pos: (150,150)
    text: 'Старый текст'
    on_press: app.func(self)


def func(self, instance_button):
    instance_button.text = "New text"
Xyanight
  • 1,315
  • 1
  • 7
  • 10
  • Thank you very much from Russia! Стоп у тебя описание русское, для кого я тут пишу на английском – Mirai Jan 23 '21 at 11:32