Select to view content in your preferred language

How to expand categories by default in python toolbox?

1272
4
09-13-2022 10:17 AM
JoshMakesMaps
Regular Contributor

When opening a new tool/toolbox, the categories are closed/condensed by default.

josh_is_fine_0-1663089199900.png

What would I add to my script to make the categories expanded by default?

0 Kudos
4 Replies
by Anonymous User
Not applicable

I that this too will need a little ArcGIS Pro SDK.  The only properties that a Parameter contains is displayName, name, datatype, parameterType, and direction. Pro's UI will default to display depending on the data type of the parameter- what are the data types of the parameters?

0 Kudos
JoshMakesMaps
Regular Contributor

Datatypes include GPLayout, DEFolder, GPBoolean, GPString, GPLong.

0 Kudos
by Anonymous User
Not applicable

I did a little digging and this might be doable by setting the stylesheet property of a python Toolbox class.  You'll have to convert your script tool to a python Toolbox though, if its not already.  I haven't done much in python toolboxes so can't tell if this will work though.

defining-a-tool-in-a-python-toolbox. 

and for the style sheet, maybe this can help (borrowed from Stack Overflow):

...

  1. Copy "C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Stylesheets\MdDlgContent.xsl" to the same folder as your script. (or somewhere it can be reached)

  2. Edit line 467 to remove STYLE="display:'none';", i.e. change:

    <DIV ID="{PropertyGroupName}" STYLE="display:'none';" onclick="window.event.cancelBubble = true;">
    

    to

    <DIV ID="{PropertyGroupName}" onclick="window.event.cancelBubble = true;">
    
RogerDunnGIS
Frequent Contributor

I also had thought that categories would be a nice way to organize my parameters, but since they are nearly all required, I did a way with categories all together.  What I do is just keep my related parameters together in the parameter list.

0 Kudos