Button function running when using an integer

I’m fairly new to Python but understand the basics of programming, I’ve come across an issue I don’t understand and trying to research this online is proving difficult.

scene1Btn.configure(text = ‘Preset Recall 1’, command = recall1)

This line of code appears in the initialise buttons section, if I keep it this way it will run the “recall1” function.

If I amend the code to try and reduce lines of code and have it say:

scene1Btn.configure(text = ‘Preset Recall 1’, command = recall(1))

I can make 1 function and adjust all values in the function based on the integer I send into it, but the problem is, when I make this change, the program runs the function without me pressing the button.

In this program there are 2 of these ‘preset’ buttons, so the program essentially runs the function twice with different values and then doesn’t update no matter which preset button I press.

If I change it back to being 2 seperate functions without the (1) and call it recall1 it doesn’t run the functions and the code works fine.

Very strange and I don’t understand why!

Thanks in advance.

recall(1) calls recall, so scene1Btn.configure(text = ‘Preset Recall 1’, command = recall(1)) is calling recall and then passing the result to configure.

use functools.partial

button = tk.Button(window, text = 'text', action = partial(func, *args))

Thanks everyone for their contribution, I just wanted to share the solution I used which worked and the one I thought was the cleanest.

command = lambda: recall(1))