title: Update Tkinter Label from variable
body: <p>I wrote a Python script that does some task to generate, and then keep changing some text stored as a string variable. This works, and I can print the string each time it gets changed.</p>
  
  <p>I can get the Label to display the string for the first time, but it never updates. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>from tkinter import *
  
  outputText = 'Ready'
  counter = int(0)
  
  root = Tk()
  root.maxsize(400, 400)
  
  var = StringVar()
  
  l = Label(root, textvariable=var, anchor=NW, justify=LEFT, wraplength=398)
  l.pack()
  
  var.set(outputText)
  
  while True:
      counter = counter + 1
      outputText = result
      outputText = result
      outputText = result
      if counter == 5:
          break
  
  root.mainloop()
  </code></pre>
  
  <p>The Label will show <code>Ready</code>, but won't update to change that to the strings as they're generated later.</p>
  
  <p>After a fair bit of googling and looking through answers on this site, I thought the solution might be to use <code>update_idletasks</code>. I tried putting that in after each time the variable was changed, but it didn't help.</p>