I have a list of options:
OPTIONS = [
"Algorithm 1",
"Algorithm 2"
]
I would like to link this function below to the option Algorithm 1:
def combine_funcs(*funcs):
def combined_func(*args, **kwargs):
for f in funcs:
f(*args, **kwargs)
return combined_func
Heres what I've tried doing:
SelectedOptions = StringVar(top)
SelectedOptions.set(OPTIONS[0])
typeOption = OptionMenu(top, SelectedOptions, *OPTIONS)
Here's my start button:
self.Button1 = tk.Button(top, command = functionschoose())
self.Button1.place(relx=0.839, rely=0.917, height=35, width=62)
Here's my function that selects which Algorithm to run
def functionschoose():
if SelectedOptions.get() == "Algorithm 1":
return combine_funcs(popup_bonus, callback)
else:
print "second func" # this is still empty because the algorithm has not been implemented yet.
For now the Algorithm gotten using .get() always seem to be Algorithm 1
I believe this is due to SelectedOptions.set(OPTIONS[0])
Is there any way to follow the real time selection of the user?
Thanks.