Saving an OptionMenu selection to a variable in Tkinter for python 2.7 Saving an OptionMenu selection to a variable in Tkinter for python 2.7 tkinter tkinter

Saving an OptionMenu selection to a variable in Tkinter for python 2.7


Is there an equivalent of a .get() command for this widget?

According to this page, StringVars do indeed have a get method. I suggest replacing

ws1['D18'] = str(equipment)

With

ws1['D18'] = equipment.get()