Skip to content

Instantly share code, notes, and snippets.

@knu2xs
Last active March 10, 2025 15:06
Show Gist options
  • Select an option

  • Save knu2xs/0bcc4bc5b9bf95751131 to your computer and use it in GitHub Desktop.

Select an option

Save knu2xs/0bcc4bc5b9bf95751131 to your computer and use it in GitHub Desktop.
Toolbox in ArcGIS Python Add-In
import arcpy
import pythonaddins
class addDefinitionQueryLayers(object):
"""Implementation for arcpyMappingAddin_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
pass
import arcpy
import pythonaddins
import os.path
class addDefinitionQueryLayers(object):
"""Implementation for arcpyMappingAddin_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
# name of toolbox without tbx extension
toolboxName = "Mapping"
# name of tool to be executed
toolName = "AddDefinitionQueryLayers"
# create string with path to toolbox
toolboxPath = os.path.join(os.path.dirname(__file__), toolboxName + ".tbx")
# call geoprocessing tool
pythonaddins.GPToolDialog(toolboxPath, toolName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment