title: How to use the Progressbar widget in real time
body: <p>I have the following code that uses the Tkinter widget:</p>
  
  <pre><code>from Tkinter import *
  from ttk import Progressbar
  
  root = Tk()
  
  def addThoseNumbers():
      y = 0
      for x in range(1000000):
          y += x
          if x % 10000.0 == 0:
              invoiceStatus['value'] = x/10000.0
      print y
  
  invoiceStatus = Progressbar(root, length = 280, mode = 'determinate')
  invoiceStatus.pack()
  invoiceButton = Button(root, text = "Confirm", font = ("Helvetica", 10), \
  command = addThoseNumbers)
  invoiceButton.pack()
  
  root.mainloop()
  </code></pre>
  
  <p>Ideally, the progressbar would update while the program is working to show how much of the task has been completed, however it just cuts from 0% to 100% once the task has completed. How do I write my program so the progressbar shows the progress in real-time?</p>