title: Kivy: Updating TextInput when pressing Button
body: <p>i'm trying to create a GUI with kivy. For this I would like to update the inputText when pushing the button within <code>screen1</code>. To organize my pages I'm using the a screen manager. What I'm trying to do basically is to input the value within the textInput with the id <code>textbox</code> as soon as the Button of this page is pressed. For this I started to prepare a class <code>readInValues</code> with the method <code>read_in</code>.</p>
  <p>As soon as the button is preshed the InputText should change from <code>Will be filled out automatically</code> to some float extracted from a file.</p>
  <pre><code>from kivy.app import App
  from kivy.uix.widget import Widget
  from kivy.uix.label import Label
  from kivy.uix.gridlayout import GridLayout
  from kivy.uix.textinput import TextInput
  from kivy.uix.screenmanager import ScreenManager, Screen
  from kivy.properties import StringProperty
  from kivy.uix.boxlayout import BoxLayout
  from kivy.base import Builder
  
          
  kv_string = Builder.load_string(&quot;&quot;&quot;
  &lt;ScreenManagement&gt;:
      MenuScreen:
          id: name
          name: 'menu'
      
      Screen1:
          id: screen1
          name: 'screen1'
  
  &lt;MenuScreen&gt;:
      BoxLayout:
          BoxLayout:
              canvas:
                  Color:
                      rgba: 184/255, 200/255, 202/255, 1
                  Rectangle:
                      pos: self.pos
                      size: self.size
        
              GridLayout:
                  cols: 4
                  rows: 4
                  
                  BoxLayout:
                      orientation: 'horizontal'
                      spacing: 10
                      padding: 10
                                    
                      Button:
                          size_hint_y: None
                          pos: (10,150)
                          size_hint: None, None
                          size: 250,50
                          text: 'button1'
                          on_press: self.background_color =  0,168/255,137/255,1
                          on_release:
                              root.manager.current = 'screen1'
                              
  &lt;Screen1&gt;:
      BoxLayout:
          orientation: 'vertical'
          Button:
              text: 'Return'
              on_press: self.background_color =  0,168/255,137/255,1
              on_release: root.manager.current = 'menu'
              pos: (0,0)
              size_hint: (1,.07)
              
          FloatLayout:
              BoxLayout:
                  canvas:
                      Color:
                          rgba: 184/255, 200/255, 202/255, 1
  
                  GridLayout:
                      cols: 2
                      Label:
                          text: 'field1:'
                      TextInput:
                          id: textbox
                          text: 'Will be filled out automatically'
                          background_color: 0,0,0,0.4
                      Label:
                          text: 'field2:'
                      TextInput:
                          id: x2
                          hint_text: 'Will be filled out automatically'
                          color: 1, 0,757, .145,1
                          background_color: 0,0,0,0.4
                      Label:
                          text: 'field3:'
                      TextInput:
                          id: x2
                          hint_text: 'Will be filled out automatically'
                          background_color: 0,0,0,0.4
                      Button:
                          text: 'fill out'
                          on_press:
                              root.callback(self.text)
  
  &quot;&quot;&quot;)
  
  class readInValues(BoxLayout):
      def read_in(self, file = 'file1.npy'):
          value = load(file)
          return value
      
      
      def input_values(self):
          Input = self.ids.textbox
          Eingabe= self.read_in_weight()
          
              
          
  class MenuScreen(Screen,readInValues):
      pass
  
  class Screen1(Screen,readInValues):
      pass
  
  
  class ScreenManagement(ScreenManager):
      pass
  
  class MyApp(App):   
      def build(self):
          return ScreenManagement()
          
      
  
  if __name__== '__main__':
      MyApp().run()
  </code></pre>