title: Tkinter buttons commands don't run
body: <p>I want to write a program where I need buttons to return an integer. So my idea was to create a local variable which gets changed. </p>
  
  <p>The problem is, that the global variable value is somehow not defined. </p>
  
  <p>Maybe somebody can help me? Thank you!!</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>def nb_1():
      global value
      value=1
  
  def nb_2():
      global value
      value=2
  
  def valueNumber():
      global value
      
      b1=Button(frame_output, text='1', command=nb_1)
      b1.pack(side=LEFT)
  
      b2=Button(frame_output, text='2', command=nb_2)
      b2.pack(side=LEFT)
  
      x=value
      return x
      
  print (valueNumber())</code></pre>
  </div>
  </div>
  </p>