Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

How does the deactivate function of an ArcGIS Python Add-in Tool work?

$
0
0

I have not been able to figure out how the deactivate function of a Python Add-in Tool works in ArcGIS.

The help page that mentions the function, and that it ’causes the tool to no longer be the active tool’ is here: http://resources.arcgis.com/en/help/main/10.1/index.html#/Tool/014p00000027000000/. I cannot find any examples of it being used.

The Tool class looks like this:

class ExampleTool(object):
    """Implementation for Example_addin.tool1 (Tool)"""
    def __init__(self):
        self.enabled = True
        self.shape = "NONE"
    def onMouseDownMap(self, x, y, button, shift):
        # My code here, then..
        self.deactivate()
    def deactivate(self):
        # Do I need to add something here..?

The help file seems to imply that when the function is called, the tool will deactivate / lose focus, but maybe I need to add something to the function to make that happen..?


Viewing all articles
Browse latest Browse all 767

Trending Articles