H
H
Hcuy2020-06-23 12:09:07
Python
Hcuy, 2020-06-23 12:09:07

How to display data from input in kivy?

Hello! I can’t figure out how to display the data that the user enters in the input
I’ll say right away that almost all the code I have is in kv files.
Here is the code:

text_1 : text_1 
        TextInput:
            id: text_1
        Button:
            text: 'Save'
            on_press: 
                    root.text_input_1(text_1)


And the python code:
class Screen2_2(BoxLayout):
  def text_input_1(self, text_1):
    print (text_1)




In this case, the code works correctly, that is, it displays the id of the widget.
But how can I display not his id, but what the user entered?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
truenotnamed, 2020-06-27
@Hcuy

class Screen2_2(BoxLayout):
  def text_input_1(self, text_1):
    print (text_1.text)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question