title: How do I make this button update a balance?
body: <p>I have this code and basically what I want to do is I want that on pressing the button the balance at the button is updated with the amount. If the balance is currently 15, and I add 10, I want it to add 10 to it. </p>
  
  <pre><code>from tkinter import *
  
  def bal():
      ans = int (input1.get ())
      total = IntVar ()
      tot = int (total.get ())
      tot = tot + ans
      res.set(tot+ans)
  
  root = Tk()
  root.geometry("1280x720")
  
  upper = Frame(root)
  upper.pack()
  
  Label(upper, text ="Sum:", font = ('raleway', 15), ).grid(row=0, column = 0)
  Label(root, text ="Balance:", font = ('raleway', 15)).place(rely=1.0, relx=0, x=0, y=0, anchor=SW)
  
  res = StringVar()
  
  input1 = Entry(upper)
  num2 = Entry(root)
  
  result = Label(root, textvariable = res,font = ('raleway',13))
  
  result.place(rely=1.0, relx=0, x=80, y=-2, anchor=SW)
  
  input1.grid(row=0,column=2)
  
  Button(upper, text ="Add Funds", command = bal).grid(row=4, column=2, ipadx = 65)
  
  mainloop()
  
  root.mainloop()
  </code></pre>
  
  <p>I tried to have a total that constantly updates in the function bal but it doesn't update for some reason. I am a python beginner, by the way :D
  Thanks for your help!</p>