I am trying to call a function when a button clicked, When clicked it should set the value of a label.
the label initialization:
labelResult = Label(root)
labelResult.grid(row=7, column=2)
the button:
buttonCal = Button(root, command=call_result(labelResult, param1, param2)).grid(row=3, column=0)
the function:
def call_result(label_result, p1, p2):
...
...
result = ...
label_result.config(text=result)
return
When I click the button, nothing happens.
The reason is the function call_result
is being executed even before I click the button.
What is going wrong here ?
am using python 3.4