title: Destroy a tkinter interface in a loop?
body: <p>I have a tkinter script, with an easy goal :
  propose 3 solutions in checkbutton, click "ok" after choice the option, and get this option.
  The code work great when I call it one time.
  But I need to do it in a loop on many possibilities, and here the probleme appear, after clicking the first "ok", I get the value, but the windows doesn't destroy completly and I cannot click on "ok" in the next option during the loop, and my program fail.</p>
  
  <pre><code>class Interface(Frame):
  
      def __init__(self, fenetre, name, choice, **kwargs):
          Frame.__init__(self, fenetre, width=768, height=576, **kwargs)
          self.choice = choice
          self.index = np.nan
          self.pack(fill=BOTH)
          self.message = Label(self, text="Current Name : " + name)
          self.message.pack()
  
          self.var_case1 = IntVar()
          self.choice1 = Checkbutton(fenetre, text=choice[0], variable=self.var_case1, command=self.choice1_action)
          self.choice1.pack(side="left", anchor=W)
          self.var_case2 = IntVar()
          self.choice2 = Checkbutton(fenetre, text=choice[1], variable=self.var_case2, command=self.choice2_action)
          self.choice2.pack(side="left", anchor=W)
          self.var_case3 = IntVar()
          self.choice3 = Checkbutton(fenetre, text=choice[2], variable=self.var_case3, command=self.choice3_action)
          self.choice3.pack(side="left", anchor=W)
          self.var_case4 = IntVar()
          self.choice4 = Checkbutton(fenetre, text="None of solution", variable=self.var_case4, command=self.choice4_action)
          self.choice4.pack(side="left", anchor=W)
  
          self.bouton_quitter = Button(self, text="Ok", command=self.ok)
          self.bouton_quitter.pack(side="right", anchor=W)
  
      def ok(self):
          if self.var_case1.get() == 1:
              self.index = (self.choice[0])
              self.quit()
          if self.var_case2.get() == 1:
              self.index = (self.choice[1])
              self.quit()
          if self.var_case3.get() == 1:
              self.index = (self.choice[2])
              self.quit()
          if self.var_case4.get() == 1:
              self.quit()
  
      def choice1_action(self):
  
          self.choice2.deselect()
          self.choice3.deselect()
          self.choice4.deselect()
  
  
  def main(name, list_name):
      fenetre = Tk()
      interface = Interface(fenetre, name, list_name)
      interface.mainloop()
      i = interface.index
      interface.destroy()
      return i
  </code></pre>
  
  <p>in the interface, choice2_action etc.. do the same as choice1 action for there button</p>
  
  <p>when I try this :</p>
  
  <pre><code>value = main("Avenger", ['Thor', 'Hulk', 'Captain'])
  if value != np.nan:
      print(value)
  </code></pre>
  
  <p>it works</p>
  
  <p>but when I try this:</p>
  
  <pre><code>for i in range(5):
      value = main("Avenger", ['Thor', 'Hulk', 'Captain'])
      if value != np.nan:
          print(value)
  </code></pre>
  
  <p>it fail
  If you can help me to understand why, it can be greatful</p>
  
  <p>Edit : 
  I need to do in a loop because the goal of my script is a string correction.
  I have a list of correct word, and a list of wrong words.
  I do a loop among my wrong word, and difflib propose the 3 closest words of the correct list words. I want the user to choose manually among these 3 words, so I did this little interface, the user can check the correction or "none of them" if it is not satisfy
  that's why I iterate </p>