title: Kivy: Manipulating dynamically created widgets in update function
body: <p>I am trying to extend the code in the answer <a href="https://stackoverflow.com/questions/24781248/kivy-how-to-get-widget-by-id-without-kv">here</a> provided by Nykakin where widgets are defined on the fly in Kivy, dynamically assigned IDs, and then  manipulated based on ID.</p>
  
  <p>The 'end game' is to implement some basic 2D physics by changing position of widgets based on ID.</p>
  
  <p>I am not able to 'walk' the widget tree from the update function (errors inline).</p>
  
  <p>Is it possible to do such a thing?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#code begins here
  from kivy.app import App
  from kivy.uix.boxlayout import BoxLayout
  from kivy.uix.stacklayout import StackLayout
  from kivy.uix.button import Button 
  from kivy.uix.label import Label 
  from kivy.clock import Clock
  from kivy.factory import Factory
  
  class MyWidget(BoxLayout):
      def __init__(self, **kwargs):
          super().__init__(**kwargs)
  
          button = Button(text="Print IDs", id="PrintIDsButton")
          button.bind(on_release=self.print_label)
          self.add_widget(button)
  
          # crate some labels with defined IDs
          for i in range(5):
              self.add_widget(Button(text=str(i), id="button no: " + str(i)))
  
          # update moved as per inclement's recommendation
          Clock.schedule_interval(MyApp.update, 1 / 30.0)
  
      def print_label(self, *args):
          children = self.children[:]
          while children:
              child = children.pop()
              print("{} -&gt; {}".format(child, child.id))
              # we can change label properties from here! Woo!
              children.extend(child.children)
              if child.id == "PrintIDsButton":
                  child.text = child.text + " :)"
  
  class MyApp(App):
      def build(self):
          return MyWidget()
  
      def update(self, *args):
          #ERROR# AttributeError: 'float' object has no attribute 'root'
          children = self.root.children[:]
  
          #ERROR# TypeError: 'kivy.properties.ListProperty' object is not subscriptable
          #children = MyWidget.children[:]
          #while children:
          #    child = children.pop()
          #    print("{} -&gt; {}".format(child, child.id))
          #    children.extend(child.children)
  
          #ERROR#  TypeError: 'kivy.properties.ListProperty' object is not iterable
          #for child in MyWidget.children:
          #    print("{} -&gt; {}".format(child, child.id))
  if __name__ == '__main__':
      MyApp().run()
  </code></pre>
  
  <ul>
  <li>Windows 7 SP1</li>
  <li>Kivy 1.8.0 / Python 3.3</li>
  </ul>
  
  <p>My apologies if my terminology is incorrect! (and thank you for your time)</p>