Validation callback only called once if no value returned by it #210
-
So I was working on another PR for the designer's UI and I needed to get a callback for some of the code template properties. Being completely new to Tk and barely having started half a year ago with Python, I just went with the "validate" callbacks. 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? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @BloodyRain2k,
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: pygubu-designer/examples/user_input/userinputapp.py Lines 82 to 89 in 7153c7e And here: Regards |
Beta Was this translation helpful? Give feedback.
Hello @BloodyRain2k,
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:
pygubu-designer/examples/user_input/userinp…