title: Getting the choice of optionmenu right after selection Python
body: <p>I was wondering if there is any way for me to see what the User has selected among the list displaying, let's say: <code>["Apple","Orange","Grapes"]</code> right after they select either one of them?</p>
  
  <p>Like when user clicks the optionbox, and clicks Apple, Tkinter will return something</p>
  
  <p>then if he switches his selection to, let's say, Orange, then that will also return something on the spot.</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>How to put parameter correctly?</p>
  
  <pre><code>from Tkinter import *
  
  def option_changed(a):
      print "the user chose the value {}".format(variable.get())
      print a
  
  master = Tk()
  
  a = "Foo"
  variable = StringVar(master)
  variable.set("Apple") # default value
  variable.trace("w", option_changed(a))
  
  w = OptionMenu(master, variable, "Apple", "Orange", "Grapes")
  w.pack()
  
  mainloop()
  </code></pre>