Controlling State with Python Add-In

665
1
02-28-2013 11:50 AM
KarlHillstrom
New Contributor III
I am trying to control the state of one button using another and nothing I have tried so far has worked. This is what should work. Any suggestions?

import arcpy
import pythonaddins

class ButtonClass1(object):
    
    def __init__(self):
        self.enabled = True
        self.checked = False
    def onClick(self):
        ButtonClass2.enabled = False
        pass

class ButtonClass2(object):
    
    def __init__(self):
        self.enabled = True
        self.checked = False
    def onClick(self):
        pass


What is the point of having these properties if you cannot set and reset them?
http://resources.arcgis.com/en/help/main/10.1/index.html#/Managing_the_state_of_Python_add_in_types/...
Tags (2)
0 Kudos
1 Reply
ChrisFox3
Occasional Contributor III
Karl,

Is the ID of the button associated with ButtonClass2 also called ButtonClass2 or is it just the class name. In the config file you will find the id, it should be something like MyAddin.button2. As the help topic says you don't need to provide the namespace, so it would just be button2.enabled = False.
0 Kudos