1

I am running ArcGIS 10.2.2 Version 10.2.2.3552, using ArcMap.

I've watched the tutorial here (http://training.esri.com/Courses/ts_PythonAdd-Ins/player.cfm?) and I'm still not understanding this. I am still in the beginner phase of understanding and using python. I have created a script that when ran outside of arcmap everything works great. Its complicated though to have people install pyscripter and then load my code. My understanding is that i can create a button in arcmap that will run the code for them? Is there a limit on what can be accomplished with this button?

When i post my script underneath and install via the add-in manager:

import arcpy
import pythonaddins
class ButtonClass4(object):
 """Implementation for Export Button_addin.button (Button)"""
 def __init__(self):
 self.enabled = True
 self.checked = False
 def onClick(self):

I get a nice little missing icon with a circle and line going through it. What am i missing here?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Mar 9, 2015 at 21:36
1
  • 1
    Yes, there is a limit, python can only go just below the surface of ArcGis; if you want to go deeper you will need C# or VB.net and ArcObjects. Based on what you're saying it sounds like the problem could be in the xml (esriaddin) that goes with the tool or that the addin path isn't found - confirm that the addin is actually added in ArcMap with the addin manager and ensure the icon can be located. Commented Mar 9, 2015 at 21:59

1 Answer 1

4

Personally, I think Python Add-ins are a little complicated for someone who is "still in the beginner phase of understanding and using python".

If you are now comfortable writing some Python code in an IDE like PyScripter (I usually just use IDLE), then I think your next logical step is to turn your code into Python script tools in standard toolboxes.

These are very easy to add to your menus as buttons by using:

  1. Customize | Customize Mode
  2. Commands tab
  3. Click [ Geoprocessing Tools ] at the bottom
  4. Click Add Tools to browse to your toolbox and tool
  5. Now that your tool appears in Commands you can drag and drop it onto any of your toolbars
  6. Close the Customize dialog to test your tool

Python Add-ins, and also Python toolboxes, are very powerful and well worth learning to use a little later but I think you will find mastering Python script tools makes a great intermediary step.

answered Mar 9, 2015 at 22:19
2
  • Very helpful! I got everything set up but one of the problems i ran into inside of arcmap for my script was my raw_input failing, EOF line. Is there a way to implement raw_input into the toolbox? Commented Mar 10, 2015 at 13:29
  • Got it working! I used sys.argv instead of raw_input :) Thanks everyone! Commented Mar 10, 2015 at 14:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.