<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Disable PYT toolbox parameter in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/disable-pyt-toolbox-parameter/m-p/1247530#M26667</link>
    <description>&lt;P&gt;I’m tasked with modifying an existing PYT toolbox…a format I’m not familiar with.&lt;/P&gt;&lt;P&gt;I do have pretty good experience with non-PYT tools, and with configuring their ToolValidator code.&lt;/P&gt;&lt;P&gt;What I’d like to do is modify the PYT so that it will open with one of the parameters in a disabled state, but I’m not sure if the code format is the same as in a ToolValidator class…like &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;params[5].enabled = False&lt;/FONT&gt;&lt;/STRONG&gt;…and I’m not sure where in the PYT to place that code.&lt;/P&gt;&lt;P&gt;Can anyone offer advice, please?&amp;nbsp; Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2023 03:41:40 GMT</pubDate>
    <dc:creator>CarlBeyerhelm</dc:creator>
    <dc:date>2023-01-12T03:41:40Z</dc:date>
    <item>
      <title>Disable PYT toolbox parameter</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/disable-pyt-toolbox-parameter/m-p/1247530#M26667</link>
      <description>&lt;P&gt;I’m tasked with modifying an existing PYT toolbox…a format I’m not familiar with.&lt;/P&gt;&lt;P&gt;I do have pretty good experience with non-PYT tools, and with configuring their ToolValidator code.&lt;/P&gt;&lt;P&gt;What I’d like to do is modify the PYT so that it will open with one of the parameters in a disabled state, but I’m not sure if the code format is the same as in a ToolValidator class…like &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;params[5].enabled = False&lt;/FONT&gt;&lt;/STRONG&gt;…and I’m not sure where in the PYT to place that code.&lt;/P&gt;&lt;P&gt;Can anyone offer advice, please?&amp;nbsp; Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 03:41:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/disable-pyt-toolbox-parameter/m-p/1247530#M26667</guid>
      <dc:creator>CarlBeyerhelm</dc:creator>
      <dc:date>2023-01-12T03:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Disable PYT toolbox parameter</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/disable-pyt-toolbox-parameter/m-p/1247536#M26668</link>
      <description>&lt;P&gt;You can change the parameter states and values in &lt;STRONG&gt;getParameterInfo()&lt;/STRONG&gt; and &lt;STRONG&gt;updateParameters()&lt;/STRONG&gt;. You can change parameter warnings and errors in &lt;STRONG&gt;updateMessages()&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;In your case, you would do something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class SomeTool:
    label = "SomeTool"

    def getParameterInfo(self):
        # define the parameters
        parameters = [
            arcpy.Parameter(...),
            arcpy.Parameter(...),
            arcpy.Parameter(...),
            ]
        # change default values, filters, and visibility
        parameters[0].filter.list = [1, 2, 3]
        parameters[1].enabled = False
        parameters[2].value = "default"
        return parameters

    def updateParameters(self, parameters):
        if parameters[0].value == 1:
            parameters[1].enabled = True
        else:
            parameters[1].enabled = False

    def updateMessages(self, parameters):
        parameters[0].setWarningMessage("You have been warned")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For more, here'S the official doc:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/parameter.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/parameter.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 06:52:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/disable-pyt-toolbox-parameter/m-p/1247536#M26668</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-12T06:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Disable PYT toolbox parameter</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/disable-pyt-toolbox-parameter/m-p/1247569#M26669</link>
      <description>&lt;P&gt;Perfect!&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;I'd been trying to use the &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;params[5].enabled = False&lt;/FONT&gt;&lt;/STRONG&gt; format from ToolValidator instead of &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;parameters[5].enabled = False.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 13:12:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/disable-pyt-toolbox-parameter/m-p/1247569#M26669</guid>
      <dc:creator>CarlBeyerhelm</dc:creator>
      <dc:date>2023-01-12T13:12:45Z</dc:date>
    </item>
  </channel>
</rss>

