I'm trying to get a button to execute a function from another file called validate.py when it's pressed, but the function seems to be executing as soon as I run the code but not when I actually press it?
Button's code:
id_validate = ttk.Button(id_frame, text='Validate',
command=validate.validate(pack_id.get()))
And this is the function's code:
def validate(pack_id):
print('vAliDAte')
return True
I want that function to execute every time I click the button and print 'validate' in the console, but it only executes once as soon as I run the code and doesn't respond when the button is pressed.
How do I stop it from executing when the code is run and only execute when the button is pressed?