Python toolbox: how to set default values

5909
5
Jump to solution
09-11-2014 08:01 AM
AlbertoLaurenti
New Contributor III

I need to set a default value for a Boolean parameter in my Python toolbox, but I didn't found any documentation about that. I'm able to do it using the custom toolbox wizard, but I found nothing on how to do the same in a python toolbox.

Any idea?

 

Thanks

0 Kudos
1 Solution

Accepted Solutions
AlexanderNohe1
Occasional Contributor III

Here is a small sample of adding a boolean value and adding a default value to it.

        booleanTest = arcpy.Parameter(

            displayName="boolTest",

            name="booleanTest",

            datatype="GPBoolean",

            parameterType="Optional",

            direction="Input")

        booleanTest.value = "true"

Does this help?

View solution in original post

5 Replies
AlexanderNohe1
Occasional Contributor III

Here is a small sample of adding a boolean value and adding a default value to it.

        booleanTest = arcpy.Parameter(

            displayName="boolTest",

            name="booleanTest",

            datatype="GPBoolean",

            parameterType="Optional",

            direction="Input")

        booleanTest.value = "true"

Does this help?

AlbertoLaurenti
New Contributor III

Thanks Alexander, it works perfectly!

DanPatterson_Retired
MVP Emeritus

Why not do it through the interface?  For example, you can right click on a toolbox script and access its properties etc, then bring up the dialog which allows you to establish the relationship etc between your input parameters and the script.  This image is a visual of establishing a Folder as an input parameter.

ScriptToolParam2.png

0 Kudos
AlexanderNohe1
Occasional Contributor III

Hi Dan,

I don't think that functionality is available with python toolboxes but rather script tools only.

DanPatterson_Retired
MVP Emeritus

Thanks Alexander ... never mind ...