title: using multi-threading to execute a simple windowed program
body: <p>Here is a piece of python code, for some reason the code asks for input before it displays the window and I want the window to appear as soon as the program starts execution.
  I think that multithreading is the answer to it but I don't know how to apply it in this case.
  Here is my code:</p>
  
  <pre><code>from difflib import get_close_matches
  from tkinter import *
  
  
  data = {'Bob':'23', 'Sahil':'17', 'Swami':'34', 'Vaibhav':'21'}
  
  def translate(w):
      w = w.lower()
      if w in data.keys():
          return data[w]
      elif w.title() in data.keys():
           return data[w.title()]
      elif w.upper() in data.keys():
           return data[w.upper()]
      elif len(get_close_matches(w, data.keys(), cutoff=0.8)) &gt; 0:
          yn = input(
              "Did u mean %s instead? Enter y if yes, or any key if no :" % get_close_matches(w, data.keys(), cutoff=0.8)[
                  0])
          if yn == 'y':
              return data[get_close_matches(w, data.keys(), cutoff=0.8)[0]]
          elif yn != 'y' and len(get_close_matches(w, data.keys(), cutoff=0.8)) &gt; 1:
              yn2 = input("Did u mean %s instead? Enter y if yes, or any key if no :" %
                          get_close_matches(w, data.keys(), cutoff=0.8)[1])
              if yn2 == 'y':
                  return data[get_close_matches(w, data.keys(), cutoff=0.8)[1]]
              elif yn2 != 'y' and len(get_close_matches(w, data.keys(), cutoff=0.8)) &gt; 2:
                  yn3 = input("Did u mean %s instead? Enter y if yes, or any key if no :" %
                              get_close_matches(w, data.keys(), cutoff=0.8)[2])
                  if yn3 == 'y':
                      return data[get_close_matches(w, data.keys(), cutoff=0.8)[2]]
                  elif yn3 != 'y':
                      return "The word doesn't exist in this dictionary"
              else:
                  return "I cannot find this in dictionary"
          else:
              return "I cannot find this in dictionary"
      else:
          return "The word doesn't exist in this dictionary"
      try:
          t.insert(INSERT, word)
  
      except:
          t.insert(INSERT, "sorry")
  
  
  while True:
      word = input("Please enter your word:")
      output = translate(word)
      if type(output) == list:
          for i in output:
              print(i)
      else:
          print(output)
      root = Tk()
      t = Text(root)
      t.pack()
      t.insert(INSERT, word)
      t.insert(INSERT, translate(word))
      root.mainloop()
  </code></pre>