title: How can I make the program restart in kivy?
body: <p>I am a newbie in kivy. I made a tic tac toe game, but when one of the player wins I want the game to restart so, the players can play it again.  How can I make this in kivy or should I reset the buttons and lists that the game based on? I have tried many things like </p>
  
  <pre><code>self.clear_widgets()
  </code></pre>
  
  <p>but it didn't work</p>
  
  <p>this is the <code>main.py</code></p>
  
  <pre><code>from kivy.app import App
  from kivy.properties import OptionProperty, ObjectProperty
  from kivy.uix.button import Button
  from kivy.uix.gridlayout import GridLayout
  from kivy.uix.popup import Popup
  from kivy.uix.label import Label
  from kivy.uix.boxlayout import BoxLayout
  
  class Option():
      p1 = []
      p2 = []
      activeplayer = 1
  
  class TicTable(BoxLayout):
      pass
  
  
  class EntryButton(Button):
      opt = Option()
      obj = ObjectProperty()
      a = ObjectProperty()
  
      def setButton(self, p):
          self.obj.text = p
          self.obj.disabled = True
  
  
      def show_winner(self, win_player):
          if win_player:
              popup = Popup(title="There is a Winner", content=Label(text=win_player), size_hint=(None, None), size=(200, 200))
              popup.open()
  
      def check_winner(self):
          p1_list = set(self.opt.p1)
          p2_list = set(self.opt.p2)
          winner = None
          winning = [{1, 2, 3}, {4, 5, 6}, {7, 8, 9},
                      {1, 4, 7}, {2, 5, 8}, {3, 6, 9}]
          for i in winning:
              if p1_list.intersection(i) == i:
                  winner = "Player X is the Winner"
                  self.show_winner(winner)
                  break
              elif p2_list.intersection(i) == i:
                  winner = "Player O is the Winner"
                  self.show_winner(winner)
                  break
  
  
  
      def play(self):
          if self.opt.activeplayer == 1:
              self.setButton("X")
              self.opt.p1.append(self.obj.n)
              self.check_winner()
              self.opt.activeplayer =2
          elif self.opt.activeplayer ==2:
              self.setButton("O")
              self.opt.p2.append(self.obj.n)
              self.check_winner()
              self.opt.activeplayer = 1
  
  
  
  class TicTacToeApp(App):
      pass
  
  
  
  if __name__ == '__main__':
      TicTacToeApp().run()
  </code></pre>
  
  <p>and this is the tictactoe.kv</p>
  
  <pre><code>&lt;EntryButton&gt;:
      obj: obj
      id: obj
      on_press: root.play()
  
  
  
  &lt;TicTable&gt;:
      orientation: "vertical"
      BoxLayout:
          EntryButton:
              n:1
              text: ""
          EntryButton:
              n:2
              text: ""
          EntryButton:
              n:3
              text:""
      BoxLayout:
          EntryButton:
              n:4
              text: ""
          EntryButton:
              n:5
              text: ""
          EntryButton:
              n:6
              text: ""
      BoxLayout:
          EntryButton:
              n:7
              text: ""
          EntryButton:
              n:8
              text: ""
          EntryButton:
              n:9
              text: ""
  
  
  
  
  TicTable:
  </code></pre>