I'm trying to learn Kivy and am still relatively new to python. I'm trying to just make the text on a button change after it's pressed. I found this old entry
but the code doesn't work.
I feel like the original line the responder suggested should be in there
a.bind(on_press=lambda *args: args[0].text = 'Opened')
At least something that tells the text to change.
Here is the code:
#button press
import kivyfrom kivy.app import Appfrom kivy.uix.button import Buttonfrom kivy.uix.label import Label
class MyApp(App): def build(self): a = Button(text='unpressed') a.bind(on_press=lambda *args: (args[0].setter('text')) return a
if __name__ == '__main__': MyApp().run()
I get:
SyntaxError: invalid syntax
user$ kivy button_press.py
File "button_press.py", line 14
return a
^
SyntaxError: invalid syntax
Thank you!!