title: add - remove widgets in kivy
body: <p>I experience some difficulties in adding or removing widgets in kivy. This is the case:</p>
  
  <p>The main form should contain two of three widgets, Widget1, Widget2, and Widget3. Pressing the button of Widget1, Widget2 should be removed and Widget3 should appear.</p>
  
  <p>This is the main.py file:</p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.boxlayout import BoxLayout
  from kivy.factory import Factory
  
  class TableApp(App):
  
      def on_pause(self): return True
  
      def on_resume(self): pass
  
  class Form(BoxLayout):
      def click(self, instance, arg):
          print 'this is the Form class'
          print 'this is my arg ... ', arg
          print 'this is the button pressed ... ', instance
          print 'these are the children of the Form class:', self.children
          Form().remove_widget(Widget2)
          Form().add_widget(Widget3)
  
  class Widget1(BoxLayout):
  
      def click(self, instance, arg):
          print 'this is the Widget 1'
          print 'this is my arg ... ', arg
          print 'this is my instance', instance, '\n'
          Factory.Form().click(instance,arg)
  
  class Widget2(BoxLayout):
      pass
  
  class Widget3(BoxLayout):
      pass
  
  if __name__ in ('__android__', '__main__'):
      TableApp().run()
  </code></pre>
  
  <p>and this is the .kv file:</p>
  
  <pre><code>#:import Factory kivy.factory.Factory
  Form:
  
  &lt;Form&gt;:
      orientation: 'vertical'
  
      Widget1:    
      Widget2:
  
  &lt;Widget1&gt;:
      Button:
          text: "Widget 1 Button" 
          on_press: root.click(self, 'arg')
  
  &lt;Widget2&gt;:
      Button:
          text: 'Widget 2 Button'
  
  &lt;Widget3&gt;:
      Button:
          text: 'Widget 3 Button'
  </code></pre>
  
  <p>In the class Form I check that Widgets1 and 2 are children of the class:</p>
  
  <pre><code>print 'these are the children of the Form class:', self.children
  </code></pre>
  
  <p>and I get:</p>
  
  <pre><code>these are the children of the Form class: [&lt;__main__.Widget2 object at 0x7fe5833317c0&gt;, &lt;__main__.Widget1 object at 0x7fe5833316e0&gt;]
  </code></pre>
  
  <p>So when I try to remove an existing child and add a new one I get:</p>
  
  <pre><code>TypeError: descriptor 'unbind' of 'kivy._event.EventDispatcher' object needs an argument
  </code></pre>
  
  <p>Could somebody help? Thank you.</p>