title: Reference objects in kivy added with python
body: <p>I need to know how to reference dynamically created objects. Like in the example, how can I change text of the buttons after creation? Normaly I would do it using their ids, but as far as I know, you can't give ids to objects created in python.</p>
  
  <p>.py code</p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.screenmanager import Screen
  from kivy.uix.button import Button
  from kivy.clock import mainthread
  
  NUMBER_OF_BUTTONS = 5
  
  
  class MapScreen(Screen):
  
      @mainthread
      def on_enter(self):
          for i in range(NUMBER_OF_BUTTONS):
              button = Button(text="B_" + str(i))
              self.ids.grid.add_widget(button)
  
  class Test(App):
      pass
  
  
  Test().run()
  </code></pre>
  
  <p>.kv code</p>
  
  <pre><code>ScreenManager:
    MapScreen:
  
  &lt;MapScreen&gt;:
    name: 'map'
  
    GridLayout:
      id: grid
      cols: 1
  </code></pre>