title: how to prevent tkinter from freezing when I click somewhere else?
body: <p>My tkinter gui starts to freeze when I click on somewhere else. Is there a way to prevent that?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#=========================
  from tkinter import *
  from time import sleep
  import random
  
  #=====================
  root=Tk()
  root.title("Wise Words")
  root.geometry("500x180+360+30")
  root.resizable(0,0)
  root.call("wm", "attributes", ".", "-topmost", "1")
  
  #===================
  def display(random):
      if random == 1:
          return "Be wise today so you don't cry tomorrow"
      elif random == 2:
          return "Frustration is the result of failed expectations"
      elif random == 3:
          return "Wishes are possibilities. Dare to make a wish"
      if True:
          sleep(4)
          r=random.randint(1,3)
          sentence=display(r)
          label.configure(text=str(sentence))
          label.update_idletasks()
  
      root.after(5000, display(random))
  
  #==================
  def Click(event):
      display(random)
  
  #====================== 
  label=Button(root, fg="white", bg="blue", text="Click to start!",
      font=("Tahoma", 20, "bold"), width=40, height=4,
      wraplength=400)
  label.bind("&lt;Button-1&gt;", Click)
  label.pack()
  
  #================
  root.mainloop()
  </code></pre>
  
  <p>Note: The label for display is the Button itself, so I name it 'label'.</p>