title: Why is my tkinter GUI freezing at the end of my program?
body: <p>I’m having trouble getting this to work can someone please please help me. My window freezes at the end of my program when it’s supposed to allow another input.
  The whole program is pasted below i've looked up help everywhere and am stuck. Sorry the code is so rough, i've been combining different snippets hoping for good luck.</p>
  <h1>using python 3.8.1</h1>
  <pre><code>import time
  from tkinter import *
  from random import randint
  answers = [&quot;It is almost certain&quot;,
  &quot;It is decidedly so&quot;,
  &quot;Without a doubt&quot;,
  &quot;Yes definitely&quot;,
  &quot;You may rely on it&quot;,
  &quot;As I see it, yes&quot;,
  &quot;Most likely&quot;,
  &quot;Outlook good&quot;,
  &quot;Yes&quot;,
  &quot;Signs point to yes&quot;,
  &quot;Reply hazy try again&quot;,
  &quot;Ask again later&quot;,
  &quot;Better not tell you now&quot;,
  &quot;Cannot predict now&quot;,
  &quot;Concentrate and ask again&quot;,
  &quot;Don't count on it&quot;,
  &quot;My reply is no&quot;,
  &quot;My sources say no&quot;,
  &quot;Outlook not so good&quot;,
  &quot;Very doubtful&quot;]
  
  queries = []
  repeat = &quot;You already asked that question.&quot;
  think = &quot;thinking...&quot;
  sorry = &quot;Sorry, I didn't understand you. Exiting...&quot;
  yes = [&quot;YES&quot;, &quot;yes&quot;, &quot;Yes&quot;, &quot;ya&quot;, &quot;Ya&quot;, &quot;YA&quot;, &quot;y&quot;, &quot;Y&quot;]
  no = [&quot;NO&quot;, &quot;no&quot;, &quot;No&quot;, &quot;nah&quot;, &quot;Nope&quot;, &quot;n&quot;, &quot;N&quot;]
  
  
  def question():
      query = e1.get()
      print(think)
      time.sleep(2)
      if query not in queries:
          queries.append(query)
      else:
          print(repeat)
      print(answers[randint(0,19)])
      restart()
  
  def restart():
      reply = input(&quot;Thanks for playing. Do you want to ask another question? &quot;)
      if reply in yes:
          e1.delete(0, END)
          question()
      elif reply in no:
          exit()
      else:
          print(sorry)
      exit()
  
  root = Tk()
  root.title(&quot;Magic 8 Ball&quot;)
  logo = PhotoImage(file=&quot;Blank.png&quot;)
  
  w1 = Label(root, image=logo).pack(side=&quot;top&quot;)
  
  w2 = Label(root,justify=CENTER,pady=10,padx=20,font=&quot;Verdana 12 bold&quot;,text=&quot;Hello! Welcome to the Magic 8 Ball.&quot;).pack(side=&quot;top&quot;)
  
  w3 = Label(root,justify=LEFT,font=&quot;Verdana 10&quot;,text=&quot;Enter your question here: &quot;).pack(side=&quot;top&quot;)
  
  
  e1 = Entry(root,width=50)
  e1.pack(side=&quot;top&quot;)
  
  
  
  b1 = Button(root,width=10,text=&quot;Submit&quot;,command=question).pack(side=&quot;top&quot;)
  
  w4 = Label(root,justify=LEFT,pady=20,font=&quot;Verdana 10&quot;,text=&quot;Answer:&quot;).pack(side=&quot;top&quot;)
  
          
  root.mainloop()
  </code></pre>