Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing an arcpy addin with ArcMap 10.2 that outputs a feature layer based on user input. How can I display attributes from this layer in a MessageBox or other reporting mechanism? I don't want to enable data driven pages, so dynamic tables don't seem to be an option. I'm sure there's an easy solution out there. Ideas?

Thanks! Katie

share|improve this question
up vote 6 down vote accepted

pythonaddins is limited in reporting and displaying attributes to users. pythonaddins is mainly a way to offer python developers a way to interact with user events. That being said the main mechanism for a developer to display messages to the user is through pythonaddins.MessageBox.

This function takes in a message formatted as a string as the first argument, a title, and a mb_type code which refers to the type of message box, i.e. OK only, Yes/No, Retry/Cancel, etc. You could feed in the attributes you would like to report in a formatted string as the first argument to pythonaddins.MessageBox() to report back to the user.

Here is a real quick (and sort of sloppy string formatting) example of feeding in an extent object and reporting this info back to the user, if you would like more code please let me know:

            rasterObject = arcpy.Raster(inRaster)
            rasterSpatialRef = rasterObject.spatialReference
            rasterExtent = arcpy.Describe(rasterObject).extent              

            hillShadeBoolean = pythonaddins.MessageBox('\t\t' + 'Top: ' + str(rasterExtent.YMax) + '\n\n' +
                                                       'Left: ' + str(rasterExtent.XMin) + '\t\t\t' +
                                                       'Right: ' + str(rasterExtent.XMax) + '\n\n' + 
                                                       '\t\t' + 'Bottom: ' + str(rasterExtent.YMin) + '\n\n' +
                                                       'Spatial Reference: ' + + '\n' +
                                                       'Units: ' + rasterSpatialRef.linearUnitName + '\n\n' +
                                                       'Would you like to create a hillshade for this raster?\n',
                                                       'Raster Extent',

pythonaddins is really a python module of only five functions although you are limited in what you can do it can still be quite powerful. Click here for more info from ESRI's documentation on the pythonaddins module.

share|improve this answer
I'll have to look at that one.. I use PyWin, mostly because it comes with a good editor with some InteliSense but partly because it has a basic message box. The pythonaddins message box looks more flexible. – Michael Miles-Stimson May 7 '14 at 0:36
Thank you! That's perfect. – user29358 May 7 '14 at 16:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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