Reputation: 15
Im trying to change the text of the textinput when the user clicks into it. ive tried the def on_enter, but in the whole file im using a screen, so thats out the window.
def test(self, *args):
self.ids.text_input.text = "test"
#self.ids.text_input.bind(on_text_validate = self.test)?
TextInput:
multiline: False
id: text_input
text:'00:00'
on_enter: app.test() #? problem area
on_press: app.test() #? problem area
Upvotes: 0
Views: 25
Reputation: 38822
You can use on_focus
instead of on_enter
or on_press
:
TextInput:
multiline: False
id: text_input
text:'00:00'
on_focus: app.test(self) # call app.test() and pass reference to the TextInput
Then the method in the App
can be:
def test(self, ti):
ti.text = "test"
Upvotes: 1