Writing a tool within a Python toolbox I ran into the problem of checking the status of some checkbox.
While setting a default value for the checkbox is no problem,
parameter_bool.value = True
it comes kind of strange to retrieve the status. If I am not completely wrong then every parameter has two possibilities to achieve that: value, and valueAsText.
First I tried to check against the value:
if parameters.value is True:
then against valueAsText,
if paramaters.valueAsText == 'true':
It took me a bit to realize that valueAsText will return either 'true' or 'None'. Why does it not return 'false'?
However to check against it did not work. This part of the loop was never touched...
I ended up in using:
if not parameter.value:
Can somebody explain to me why it is impossible to check against the textual value by using the same strings that will be returned if I retrieve them this way?:
Wouldn't it be much easier to simply check the value against True/False?