title: How can I measure elapsed time between the press of buttons in python with tkinter?
body: <p>I'm very new to python and I'm trying to do a little project for myself, but I don't understand how to use the initial time variable from the start function in the stop function where I can do math with it. This is my code currently:</p>
  
  <pre><code>import time
  import Tkinter
  import tkMessageBox
  
  top = Tkinter.Tk()
  
  def start_time():
     tkMessageBox.showinfo("Timer", "The timer will now begin")
     initial = time.time()
     return initial
  
  def stop_time(initial):
     final = time.time()
     tkMessageBox.showinfo("Timer", final - initial)
  
  Start = Tkinter.Button(top, text ="Start", command = start_time)
  Stop = Tkinter.Button(top, text ="Stop", command = stop_time)
  Start.pack()
  Stop.pack()
  top.mainloop()
  </code></pre>