Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Using Validator Class to Update Value List Parameter

$
0
0
With the validator class in the arcpy GUI, we can update a value list using the filter.list property:

Code:

fc = "path to fc"
vList = [str(i.getValue("SITE_NAME")) for i in arcpy.SearchCursor(fc)]
self.params[2].filter.list = vList

This will update a list of SITE NAMES from the fc upon GUI initiation (using a string parameter type). When the tool appears, as expected, the list is populated with the ability to toogle on and off each item in the list with a check mark. The list populates with all items as 'unchecked' by default. Is there a way to update the validator class to populate the list with all the items 'checked'?

I played around with setting the values to True:

Code:

self.params[2].filter.enabled = True
Code:

self.params[2].Value = True
I've gone through the lsit of parameters method and properties and I don't see a property that allows me to set the list values to true:

http://resources.arcgis.com/en/help/...0000002m000000

http://resources.arcgis.com/en/help/...00000006000000

Viewing all articles
Browse latest Browse all 2485

Latest Images

Trending Articles



Latest Images