Skip to content

Validation callback only called once if no value returned by it #210

Discussion options

You must be logged in to vote

Hello @BloodyRain2k,

But since I don't know the inner workings of either Tk nor PyGubu, I found out that if a "validate" callback doesn't return any value, it is never called a 2nd time.
Is that on purpose?

Yes, that is the default behavior. If you don't return a boolean value the validation is disabled. According to tk documentation:

The Tk themed entry widget only disables validation if one of the validation scripts raises an error, or if -validatecommand does not return a valid boolean value. (Thus, it is not necessary to re-enable validation after modifying the entry value in a validation script).

You have some validation examples here:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BloodyRain2k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants