Skip to content

Selection control

Check Box

A simple parameter providing a bool value (True or False)

Parameter CheckBox

<Parameter>
    <Name>CheckBoxValue</Name>
    <Text>CheckBox</Text>
    <Value>False</Value>
    <ValueType>CheckBox</ValueType>
</Parameter>

Radio Button

A parameter allowing a single choice and providing a corresponding value, which can be either integer, float or string. The <Parameter> node with the value type RadioGroup groups the child <Parameter> nodes with the type RadioButton and is the value holder for the value of the selected radio button. Within the PythonPart script (py-file), the selected value is then also accessed via this parameter.

Parameter RadioButton

<Parameter>
    <Name>RadioGroupValue</Name>
    <Text>RadioGroup</Text>
    <Value>1</Value>
    <ValueType>RadioButtonGroup</ValueType>

    <Parameter>
        <Name>RadioButtonValue1</Name>
        <Text>RadioButton</Text>
        <Value>1</Value>
        <ValueType>RadioButton</ValueType>
    </Parameter>
    <Parameter>
        <Name>RadioButtonValue2</Name>
        <Text>RadioButton</Text>
        <Value>2</Value>
        <ValueType>RadioButton</ValueType>
    </Parameter>
    <Parameter>
        <Name>RadioButtonValue3</Name>
        <Text>RadioButton</Text>
        <Value>3</Value>
        <ValueType>RadioButton</ValueType>
    </Parameter>
</Parameter>

Named tuple

It's also possible to create the RadioButton from a list of namedtuples.

Parameter RadioButton

<Parameter>
    <Name>ImportFileSelection</Name>
    <Text>Import</Text>
    <Value>[_]</Value> <!--(1)!-->
    <ValueType>namedtuple(DisplayText,RadioButton)</ValueType>
    <NamedTuple>
        <TypeName>ImportFileSelection</TypeName>
        <FieldNames>RowText,FileSelection</FieldNames>
    </NamedTuple>
</Parameter>
  1. The values are filled dynamically in a script. See example PythonPart.

Example

Check out the examples provided in:

  • …\etc\Examples\PythonParts\PaletteExamples\RadioButtons.pyp
  • …\etc\PythonPartsExampleScripts\PaletteExamples\RadioButtons.py