title: Global name v is not defined (but it actually is)? tkinter/python
body: <p>I keep getting this error "global name v is not defined."  I know this has most likely been heavily documented, however none of the other threads were very relavant to my GUI situation.  Anyway, here we go:</p>
  
  <pre><code>v_amount= 5000
  
  def set_v_to_something_else():
      global v
      v_amount=v_amount-1000
      v.set(v_amount)
  
  v = StringVar()
  v.set(str(v_amount))
  
  #create button that will allow v label to be set to something else
  
  vbutton = Button(root, text = "change v", command = set_v_to_something_else).pack()
  vlabel = Label(root, textvariable=v).pack()
  </code></pre>
  
  <p>Once again, it says that v is not defined, even though i set it equal to StringVar()</p>
  
  <p>Thanks in advance</p>