title: Adding command to a Tkinter OptionMenu?
body: <p>I'm writing some code in Python 2.7.8 which includes the <code>OptionMenu</code> widget. I would like to create an <code>OptionMenu</code> that calls a function when the option is changed but I also want the possible options to be found in a list, as my final <code>OptionMenu</code> will have many options.</p>
  
  <p>I have used the following code to create an <code>OptionMenu</code> that calls a function:</p>
  
  <pre><code>from Tkinter import*
  
  def func(value):
      print(value)
  
  root = Tk()
  
  var = StringVar()
  DropDownMenu=OptionMenu(root, var, "1", "2", "3", command=func)
  DropDownMenu.place(x=10, y=10)
  
  root.mainloop()
  </code></pre>
  
  <p>I have also found the following code that creates an <code>OptionMenu</code> with options found in a list:</p>
  
  <pre><code>from Tkinter import*
  
  root = Tk()
  
  Options=["1", "2", "3"]
  var = StringVar()
  DropDownMenu=apply(OptionMenu, (root, var) + tuple(Options))
  DropDownMenu.place(x=10, y=10)
  
  root.mainloop()
  </code></pre>
  
  <p>How would I create an <code>OptionMenu</code> that calls a function when the option is changed <strong>and</strong> gets the possible options from a list?</p>