Yair Yair - 7 months ago 64
Python Question

kivy - save user input into a python list

I`m having some difficulties understanding the interrelation between kivy and python.

I`m trying to do something super simple, as a first step, and it would be great if anybody could show an example:
How can I store input data into a python list once the user feeds-in data and press "enter"?


An example of this. User can input 3 things and they get stored in an array. If you want the user to input one thing and store it in an array you will have to split the input.

result = []
for i in range(3):
    answer = input()


NOTE: input() is raw_input() in python2.x

In kivy:

from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput

class Screen(GridLayout):
    def __init__(self, **kwargs):
        super(Screen, self).__init__(**kwargs)
        self.input = TextInput(multiline=False)
    def print_input(self, value):

class MyApp(App):

    def build(self):
        return Screen()

if __name__ == '__main__':

This simple script will give you an input box and when you press enter it will print its text to terminal. You can easily store it in a list if you wish.