Reputation: 13
My code :-
def load():
label.configure(text="Error")
button = tkinter.Button(main,width=8,text="Continue >", command="load")
and the window is running perfectly but the callback is not running, I have tried many kind of callbacks like printing configuring etc. but didn't worked. What is solution?
Upvotes: 0
Views: 46
Reputation: 553
In your code you passed load as a string .So it doesn't work. Because command in the sense what command should be performed when the component Button is clicked. So try to change it don't pass it as a string .
Change it as
button = tkinter.Button(main,width=8,text="Continue >", command=load)
Upvotes: 1
Reputation: 10671
The command
argument is expecting to have a function, Not a string.
Instead of string, use the the function.
Instead of:
button = tkinter.Button(main,width=8,text="Continue >", command="load")
write:
button = tkinter.Button(main,width=8,text="Continue >", command=load)
Upvotes: 1