<?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 Python Addin Action based on Property Value in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38249#M2986</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I'm relatively new to this but I'm trying to create a simple button through a Python Addin that will turn a layer on or off. I can get the layer to turn on, but not off when I reclick the same button. I figured that if I used the self.checked property for the buttonit would work but then I got the [Missing] Error indicating my syntax was bad. Idle was referencing the = sign I used in the If/Else statement when I went to perform the action based off of the property value. Here's the code that gave me the [Missing] error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import pythonaddins&amp;nbsp; class Toggle_Cust(object): &amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for C1_Cust.button (Button)""" &amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False &amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Get the current Map Document and Create the Layer Index. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("Current") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers = arcpy.mapping.ListLayers (mxd) [1] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Turn the Layer On or Off depending on property value &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.checked = True: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers.visible = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Customers On!" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers.visible = False &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Customers Off!" &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So just to test the premise I just tried turning on the layer with&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import pythonaddins&amp;nbsp; class Toggle_Cust(object): &amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for C1_Cust.button (Button)""" &amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False &amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Get the current Map Document and Create the Layer Index. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("Current") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyrlist = arcpy.mapping.ListLayers (mxd) [0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Identify the Customer Layer by Index Value &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers = arcpy.mapping.ListLayers (mxd) [1] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers.visible = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Customers On!" &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That works to just turn on the layer. Anyone got any advice on turning the layer back off with another click of the same button?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Sep 2012 15:20:33 GMT</pubDate>
    <dc:creator>JohnDye</dc:creator>
    <dc:date>2012-09-12T15:20:33Z</dc:date>
    <item>
      <title>Python Addin Action based on Property Value</title>
      <link>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38249#M2986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I'm relatively new to this but I'm trying to create a simple button through a Python Addin that will turn a layer on or off. I can get the layer to turn on, but not off when I reclick the same button. I figured that if I used the self.checked property for the buttonit would work but then I got the [Missing] Error indicating my syntax was bad. Idle was referencing the = sign I used in the If/Else statement when I went to perform the action based off of the property value. Here's the code that gave me the [Missing] error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import pythonaddins&amp;nbsp; class Toggle_Cust(object): &amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for C1_Cust.button (Button)""" &amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False &amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Get the current Map Document and Create the Layer Index. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("Current") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers = arcpy.mapping.ListLayers (mxd) [1] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Turn the Layer On or Off depending on property value &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.checked = True: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers.visible = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Customers On!" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers.visible = False &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Customers Off!" &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So just to test the premise I just tried turning on the layer with&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import pythonaddins&amp;nbsp; class Toggle_Cust(object): &amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for C1_Cust.button (Button)""" &amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False &amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Get the current Map Document and Create the Layer Index. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("Current") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyrlist = arcpy.mapping.ListLayers (mxd) [0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Identify the Customer Layer by Index Value &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers = arcpy.mapping.ListLayers (mxd) [1] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COF_Customers.visible = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Customers On!" &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That works to just turn on the layer. Anyone got any advice on turning the layer back off with another click of the same button?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2012 15:20:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38249#M2986</guid>
      <dc:creator>JohnDye</dc:creator>
      <dc:date>2012-09-12T15:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addin Action based on Property Value</title>
      <link>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38250#M2987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey, your equals sign should be a double egual sign in an if/else statement like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if self.checked == True&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, you might want to loop through your layers, instead of indexing. I always seem to have problems with the indexing,s o I usually do something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for lyr in arcpy.mapping.ListLayers(mxd):

&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.name == "your layer name":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.checked == True:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "your layer name".visible = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Customers On!"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "your layer name".visible = False
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Customers Off!"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that's what you're looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:29:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38250#M2987</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2021-12-10T21:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addin Action based on Property Value</title>
      <link>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38251#M2988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Mike,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That kind of worked. The only problem now is that because the button initializes with&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
self.checked = False
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I now have to figure out how to make the property change to the opposite of the current value whenever the button is clicked. Otherwise, it will always be set to False.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:29:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38251#M2988</guid>
      <dc:creator>JohnDye</dc:creator>
      <dc:date>2021-12-10T21:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addin Action based on Property Value</title>
      <link>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38252#M2989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use the &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;not &lt;/SPAN&gt;&lt;SPAN&gt;operator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;layer.visible = not layer.visible
self.checked = layer.visible&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:29:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38252#M2989</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2021-12-10T21:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addin Action based on Property Value</title>
      <link>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38253#M2990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure what you mean. I mean I understand what the not operator is, just as I read the code, I'm not sure I understand how you're suggesting I implement it. Would you mind posting a more throughout example?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Sep 2012 15:17:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38253#M2990</guid>
      <dc:creator>JohnDye</dc:creator>
      <dc:date>2012-09-13T15:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addin Action based on Property Value</title>
      <link>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38254#M2991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;SOLVED!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for recommendations! Here's the solution for turning layers and off with a single button button:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import pythonaddins&amp;nbsp; class Toggle_Cust(object): &amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for C1_Cust.button (Button)""" &amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False &amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Get the current Map Document and Create the Layer Index. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("Current") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListLayers (mxd): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.name == "COF_Cust": &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.visible == False: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.visible = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif lyr.visible == True: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.visible = False &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's important to note that the self.checked property does not loop when layers are turned on or off, like I thought it would. It seems to remain constant initialization. I thought when I turned a layer on, it would change automatically to True but it doesn't. I tested this by inserting a print statement and converting the boolean value that the property held to string and printing the value as I turned the layer on and off. It remained set to false regardless of layer visibility. I suppose I miunderstood what the self.checked property is doing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 14:28:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38254#M2991</guid>
      <dc:creator>JohnDye</dc:creator>
      <dc:date>2012-09-17T14:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Python Addin Action based on Property Value</title>
      <link>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38255#M2992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just realized exactly what the Checked property is doing for anyone reading this post. It's simply allowing a button you create to apper pressed or not. See &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000029000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000029000000&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2012 11:37:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-addin-action-based-on-property-value/m-p/38255#M2992</guid>
      <dc:creator>JohnDye</dc:creator>
      <dc:date>2012-12-20T11:37:43Z</dc:date>
    </item>
  </channel>
</rss>

