New answers tagged python-addin
Ok, I solved it myself. The problem was that it could not read the name of the layer to be added to group. for dirpath, dirnames, filenames in arcpy.da.Walk(r"Z:/IMAGES/MAPS/15_Min_Thematic_Maps",topdown=True, followlinks=True, type="TIF"): for filename in filenames: if Sel in filename.upper(): print filename ...
I think you can use the addOutputsToMap (=False) property from the env class in arcpy. Further details here: http://resources.arcgis.com/en/help/main/10.2/index.html#//018z0000004s000000
Additional options are: Do as your doing, but use conditional logic to see if layer exists or not in map (that way you will not get an error if layer does not exist): for layer in arcpy.mapping.ListLayers(mxd, "Template"): if layer.name == "MyNewLayer": arcpy.mapping.RemoveLayer(df,layer) Call IGeoProcessor.AddOutputsToMap Property (ArcObjects ...
Try unchecking the 'Add results of geoprocessing operations to the display' in the Geoprocessing Options in ArcMap. You can also access this option via the addOutputsToMap property of the env class: just add arcpy.env.addOutputsToMap = 0 in the beginning of your script.
Assuming ArcGIS, here is an example Python Addin that calculates areas: class CalculateArea(object): """Implementation for Test_addin.calculateArea (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): # Set mxd to current and data frame to active mxd = ...
You may use: pythonaddins.MessageBox() See links below for examples: Getting results from your Python Add-in buttons The pythonaddins module
Yes you can, you could do it by adding a global variable that keeps track of your clicks. For example: class ToolClass2(object): """Implementation for Test_addin.tool (Tool)""" def __init__(self): self.enabled = True self.shape = "NONE" global clickCount clickCount = 0 def onMouseDownMap(self, x, y, button, shift): global clickCount ...
Your Normal.mxt is possibly corrupt. Go to: C:\Users\Name\AppData\Roaming\ESRI\Desktop10.2\ArcMap\Templates and delete the Normal.mxt file. This will remove all toolbars/customization from ArcMap. Here's a little more information from ESRI.
The following code uses the approach of calling a subprocess and piping the text to the clipboard. A couple of things to note: I use the onMouseUpMap event, this returns the XY coordinates in map units. I placed a comma between the numbers so there is no space between them. Wrapped the code up in a try-except to capture any failures. import arcpy import ...
Top 50 recent answers are included