title: Tkinter Trace and ValueError: invalid literal for int() with base 10: ''
body: <p>I'm new to Python/programming, so please be gentle! I've been fairly good at figuring stuff out for myself (or finding answers here!) so far, but i've been struggling with this for a while now..
  Using Tkinter, I want a label to print the sum of two entry fields, updating automatically after each entry input. This is where I've got to:</p>
  
  <pre><code>from Tkinter import *
  import ttk
  
  root = Tk()
  
  first_var = IntVar()
  second_var = IntVar()
  total_var = IntVar()
  
  para = [0, 0]
  
  def totalupdate(*args):
      global para
      para[0] = first_var.get()
      para[1] = second_var.get()
      newtotal = sum(para)
      total_var.set(newtotal)
  
  first_var.trace('w', totalupdate)
  second_var.trace('w', totalupdate)
  
  first = ttk.Entry(root, textvariable=first_var)
  second = ttk.Entry(root, textvariable=second_var)
  total = ttk.Label(root, textvariable=total_var)
  
  first.grid()
  second.grid()
  total.grid()
  
  root.mainloop()
  </code></pre>
  
  <p>So, this seems to work fine within the Tk window, but it throws up </p>
  
  <pre><code>Traceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/T‌​kinter.py", line 1410, in __call__
    File "para.py", line 15, in totalupdate
      para[1] = second_var.get()
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/T‌​kinter.py", line 283, in get
  ValueError: invalid literal for int() with base 10: '' 
  </code></pre>
  
  <p>in the terminal window any time I use .get() within a trace callback function. I've tried multiple ways of getting around this to no avail. I'm sure there's a pretty simple solution, and it doesn't seem to affect the program but its bugging me! Any help much appreciated, as well as any comments concerning a better way to achieve what I'm trying to do. Many thanks!</p>