Using qpython and kivy on my android phone, I'm trying to write a program that inputs some text, processes it and shows the output.
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
class TestApp(App):
def build(self)
r = TextInput(multiline=False).text
y = self.dosomething(r)
return Button(text = y)
def dosomething(self, x):
y = x + ' something'
return y
TestApp().run
This fails - when I push run it doesn't ask for input and just display 'something'.
How do I fix this so I can actually get some text input from the user?
EDIT replace build with:
def build(self):
def cb(instance, value):
print(value)
r = TextInput(focus=True, multiline=False)
r.bind(text=cb)
return r