am doing a GUI which includes option menu I have defined the following menu to take the options from a list, however I would like to make the each option call a different function, but I couldn't figure out how to do it.
options = ["Modem ID: 20",
"Modem ID: 30",
"Modem ID: 40",
"Modem ID: 50"]
selected_Option
selected_Option = tk.StringVar(self)
selected_Option.set(options[0])
drop_Menu =apply(OptionMenu, (self, selected_Option) + tuple(options))
drop_Menu.place(relx=.809, y=5)
You can use
.trace(..)
function onStringVar
to monitor the change of the value, and then do whatever you want based on the selected option: