3

I'm trying to create a Custom Python Addin for ArcMap, which contains a custom tool, and also needs to have the standard 'Save As' button.

After referring to https://blogs.esri.com/esri/arcgis/2012/08/27/python-add-ins-how-to-add-built-in-commands-to-your-custom-toolbar-or-menu/,

I've added a Tag <Button refID="esriArcMapUI.MxFileMenuItem" subtype="4" />

This shows the button in the toolbar, but only as text.

How can I get it to show up as an Image? I know that the 'Save As' command doesn't have an Image in the File Menu, so I can supply a new image for it.

2

Images are added to toolbars and buttons etc when using the Addin Wizard. If you want to add images after the fact, you would first place the image in the Images folder that is created when you make your addin.

enter image description here

Next you would want to edit the config.xml file with a text editor that is in this directory as well.

In this example this is what the xml would like for a button before I had a photo in my Images folder.

<Button caption="Testing_Coug" category="Python Addin" class="ButtonClass1" id="Coug_addin.button" image="" message="" tip=""><Help heading="" /></Button>

and this what it look like after you have edited the xml using the name of the .png image that you placed in the images folder. In this instance I used an image called "map".

<Button caption="Testing_Coug" category="Python Addin" class="ButtonClass1" id="Coug_addin.button" image="Images\map.PNG" message="" tip=""><Help heading="" /></Button>

After you have done that, run the makeaddin.py file and re-add the addin to your map. You may have to experiment with the size of the image and there are limited file types for images you can use. PNG seems to be the default.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.