Skip to content

Instantly share code, notes, and snippets.

@knu2xs
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knu2xs/8955815 to your computer and use it in GitHub Desktop.
Save knu2xs/8955815 to your computer and use it in GitHub Desktop.
Example onclick event to streamline the process of including a toolbox and tool as part of a Python add-in
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