I am writing a Python toolbox with (among other) 3 parameters: 2 boolean (check boxes) and 1 string. The string parameter's properties depends on the 2 booleans' value:
Working the other way round (string initially enabled and required and changing its state if the booleans are altered) would be fine too.
def updateParameters(self, params): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" if params[1].altered: # first boolean parameter if params[1].value == 1: params[8].enabled = 1 # string parameter params[8].parameterType = "Optional"
أكثر...
- If at least the first boolean is true (box checked), the string (defined initially as disabled and optional) must be set to enabled and required.
- If only the second boolean is true, the string must remain disabled and optional.
Working the other way round (string initially enabled and required and changing its state if the booleans are altered) would be fine too.
def updateParameters(self, params): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" if params[1].altered: # first boolean parameter if params[1].value == 1: params[8].enabled = 1 # string parameter params[8].parameterType = "Optional"
أكثر...