title: Python : How to remove widget in kivy
body: <p>I have two file <code>demo.py</code> and <code>demo.kv</code>.<br/>
  when i run <code>demo.py</code> after click on menu then shows <code>+Add more</code> button.When i click on <code>+Add more</code> button then <code>three row</code> add dynamic because i am using <code>loop</code> there.Every time add <code>three row</code> dynamic <br/>
   But can anyone tell me when i add <code>new row</code> then how to remove <code>previous three row</code>?<br/>
  Every time should be show only <code>3 new row</code> and previous row should be <code>delete</code>.I am using code <br/> <br/></p>
  
  <pre><code>def add_more(self):
      self.remove_widget(Row())
      for x in range(0, 3):
          self.row_count += 1
          self.add_widget(Row(button_text=str(self.row_count)))
  </code></pre>
  
  <h1>demo.py</h1>
  
  <pre><code>from kivy.app import App
  from kivy.lang import Builder
  from kivy.core.window import Window
  from kivy.uix.boxlayout import BoxLayout
  from kivy.properties import BooleanProperty, ListProperty, StringProperty, ObjectProperty, NumericProperty
  from kivy.uix.popup import Popup
  
  Window.clearcolor = (0.5, 0.5, 0.5, 1)
  Window.size = (500, 400)
  
  class User(Popup):
      total_value = ObjectProperty(None)
  
      def __init__(self, **kwargs):
          super(User, self).__init__(**kwargs)
  
      def add_more(self):
          self.ids.rows.add_more()
  
  
  class Row(BoxLayout):
      col_data = ListProperty(["?", "?", "?", "?", "?"])
      name = ObjectProperty(None)
      button_text = StringProperty("")
      col_data3 = StringProperty("")
      col_data4 = StringProperty("")
  
      def __init__(self, **kwargs):
          super(Row, self).__init__(**kwargs)
  
  
  class Rows(BoxLayout):
      row_count = 0
  
      def __init__(self, **kwargs):
          super(Rows, self).__init__(**kwargs)
          self.add_more()
  
      def add_more(self):
          self.remove_widget(Row())
          for x in range(0, 3):
              self.row_count += 1
              self.add_widget(Row(button_text=str(self.row_count)))
  
  
  class rv(BoxLayout):
      data_items = ListProperty([])
      mode = StringProperty("")
  
      def __init__(self, **kwargs):
          super(rv, self).__init__(**kwargs)
  
  
      def add(self):
          self.mode = "Add"
          popup = User()
          popup.open()
  
  
  class MainMenu(BoxLayout):
      content_area = ObjectProperty()
  
      def display(self):
          self.rv = rv()
          self.content_area.add_widget(self.rv)
  
  class demo(App):
  
      def build(self):
          return MainMenu()
  
  
  if __name__ == '__main__':
      demo().run()
  </code></pre>
  
  <h1>demo.kv</h1>
  
  <pre><code>&lt;Row&gt;:
      size_hint_y: None
      height: self.minimum_height
      height: 40
  
      Button:
          text: root.button_text
          size_hint_x: None
          top: 200
  
      TextInput:
          id : name
          text: root.col_data3
          width: 300
      TextInput:
          id: number_input
          text: root.col_data4
          width: 300
          input_filter: 'int'
  
  
  &lt;Rows&gt;:
      size_hint_y: None
      height: self.minimum_height
      orientation: "vertical"
  
  &lt;User&gt;:
      id: user
      BoxLayout:
          orientation: "vertical"
          padding : 20, 5
  
  
          BoxLayout:
              orientation: "horizontal"
              #padding : 10, 10
              spacing: 10, 10
              size: 450, 40
              size_hint: None, None
  
              Label:
                  size_hint_x: .2
                  text: "Number"
                  text_size: self.size
                  valign: 'bottom'
                  halign: 'center'
  
              Label:
                  size_hint_x: .4
                  text: "name"
                  text_size: self.size
                  valign: 'bottom'
                  halign: 'center'
  
              Label:
                  size_hint_x: .4
                  text: "Value"
                  text_size: self.size
                  valign: 'bottom'
                  halign: 'center'
  
          ScrollView:
              Rows:
                  id: rows
  
  
          BoxLayout:
              orientation: "horizontal"
              size_hint_x: .2
              size_hint_y: .2
  
              Button:
                  text: "+Add More"
                  on_press: root.add_more()
  
  &lt;rv&gt;:
      BoxLayout:
          orientation: "vertical"
  
          Button:
              size_hint: .25, .03
              text: "+Add"
              on_press: root.add()
  
          GridLayout:
              size_hint: 1, None
              size_hint_y: None
              height: 25
              cols: 3
  
          BoxLayout:
              orientation: "vertical"
  
  
  &lt;MenuButton@Button&gt;:
      text_size: self.size
      valign: "middle"
      padding_x: 5
      size : (100, 40)
      size_hint : (None, None)
      background_color: 90 , 90, 90, 90
      background_normal: ''
      color: 0, 0.517, 0.705, 1
      border: (0, 10, 0, 0)
  
  &lt;MainMenu&gt;:
      content_area: content_area
  
      BoxLayout:
          orientation: 'vertical'
          spacing : 10
  
          BoxLayout:
              canvas.before:
                  Rectangle:
                      pos: self.pos
                      size: self.size
  
              size_hint_y: 2
  
              MenuButton:
                  text: 'Menu'
                  size : (50, 12)
                  on_release: root.display()
  
          BoxLayout:
              id: content_area
              size_hint_y: 30
  </code></pre>