There is a list :
liste_physical_activity.insert(1, pa1)
liste_physical_activity.insert(2, pa2)
liste_physical_activity.bind(\'<>\',
energy_requirement
is being passed a reference to main_window
, so all you need to do is pass that value along in the binding. This should work:
def energy_requirement(window_mother):
...
liste_physical_activity.bind('<<ListboxSelect>>',
lambda event, mw=window_mother: CurSelet_physical_activity(event, mw))
You'll then need to modify CurSelet_physical_activity
to accept this additional parameter:
def CurSelet_physical_activity(event, main_window):
...
if value==pa1:
ER=1
label = Label(main_window, text="Energy Requirement (kcal ME/day)")
...
It doesn't look like you use event
anywhere in CurSelet_physical_activity
, so you can remove that from the binding and from the parameter list of the function if you want.