title: How to return value from tkinter button callback
body: <p>I have a function that has a tkinter window defined and run inside of it. There is a button in that window, and I need the button to execute a <code>return</code> statement and return a value for the function.</p>
  
  <p>The way to do things other than run argumentless functions from button callbacks seems to be <code>lambda</code>, but I can't figure out a way to do this with <code>lambda</code>, as any value returned from the lambda registers as the return value for the <code>lambda</code>.</p>
  
  <p>The gist of my code is like this:</p>
  
  <pre><code>from tkinter import *
  
  def function():
      root = Tk()
  
      entry = Entry(root)
      entry.pack()
  
      button = Button(root, text = "I'm a button", command = return entry.get()) #Does not work, you can't do this in a callback
      button.pack()
  
      root.mainloop()
  </code></pre>
  
  <p>What I'm trying to figure out is how to rewrite that return statement so that it is valid for the <code>command</code> argument.</p>