I know that to call a function when a button is clicked, we write command = name_of_function within the button widget parentheses. But, when we try to pass a value into the function by adding an argument within parentheses after the function name, the function is called too early and not when the button is clicked.
I know that we can use lambda to get around this e.g. command = Lambda: name_of_function(argument).
But what I don't understand is why does lambda work, and not a normal function call with parentheses and arguments?
For example, this works:
editmenu.add_command(label="1. Problem Definition", command=lambda: changeText(0))
but this doesn't:
editmenu.add_command(label="1. Problem Definition", command=changeText(0))