Parameter with a Python namedtuple¶
The value of the PythonPart parameter can be created as a Python namedtuple object, defined by the used value types. For each value type a control will be created in the property palette like
Syntax¶
The values in the <Value> tag must be separated by the pipe | character. This is also required for a used <ValueTextId> tag.
If an empty or only a single text is used for the Text tag, all controls of the namedtuple values are created in one row in the property palette.
A combination with the Python list is possible. In this case the default values for each row must be separated by the ; character as follows
In general, tag data can be split across more than one row, except that the first row’s data must start immediately after the tag.
Define the row text for a list¶
Each row of the list in the property palette can be provided with its own text. In this case, the first field in the named tuple must be filled with these row text and the value type of this field must be DisplayText.
The value for the RowText field must be created in the xxx.py file of the PythonPart. The result may look like this
Hide and disable controls¶
Sometimes it’s useful to disable or hide controls depending on the value of another parameter. This is achieved by adding additional tags to the parameter or by defining functions in the py-file. See Enable and visible options
Depending on the row (in case of a list of namedtuple) and the field name of the namedtuple, the visible and enable state of the control can be returned from the defined functions. The result in the property palette may look like this
Access to list row values¶
The special keyword $list_row allows access to tuple values from a row in the tags <Visible>, <Enable>, <MinValue> and <MaxValue>.
Example¶
The implementation of the namedtuple value type is described in the example NamedTuple, which is located in