title: tkinter - How to get which menu item caused callback?
body: <p>I would like to have a single callback function for my menu.  In order to determine what action to take in the callback, I need to know which menu item generated the callback. I have been unable to figure this out.</p>
  
  <p>I see an option called "variable" in the add call, but when I try to use it I get an error.  I thought perhaps it would allow me to specify a StringVar that the menu text would be stored in.</p>
  
  <p>Would like to know in the hello function who generated the callback.  Is it possible to specify a parameter that can be passed in?</p>
  
  <pre><code>from tkinter import *
  
  root = Tk()
  
  def hello():
      print ("hello!")
  
  # create a toplevel menu
  menubar = Menu(root)
  menubar.add_command(label="Hello!", command=hello)
  menubar.add_command(label="Quit!", command=hello)
  
  # display the menu
  root.config(menu=menubar)
  
  mainloop()
  </code></pre>