0

I have some confusion about the way a function "processOK" is being called here. it usually is something like command=processOK(). I ve recently started learning Python as an additional skill, would be thankful if you could clarify. Also please state the difference between a normal class and widget classes.

btOK = Button(window, text = "OK", fg = "red", command = processOK)

1 Answer 1

1

The only significant difference between a widget class and a "normal" class -- whatever that is -- is that Tkinter widget classes wrap objects created by the underlying tkinter engine (specifically, an embedded tcl/tk interpreter).

As for the command options of buttons, it takes a reference to a callable function. So, it would be ..., command=processOK, not ..., command=processOK(). If you need to pass arguments to the function you must use lambda, functools.partial, or something similar.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.