jamesfreddyc

Python Add-In Tool and Python Window (ArcMap 10.1)

Discussion created by jamesfreddyc on May 16, 2013
I am getting some strange behavior with any Python Add-In tool that I deploy.  I only noticed this because I have a tool that reports map x/y values as the mouse pans across the data view (aka, onMouseMoveMap event) --- this works just fine!

The weird thing I have noticed is a result of that tool and having the python window open.  I have another tool on the same add-in toolbar that does not report anything and has "pass" value in every event except the onLine event.  What is happening is that when this tool is activated and the mouse moved across the map display, the python window updates with blank lines.

>>>>
>>>>
>>>>
>>>>

...is what continuously printed.  And no, I do not have any print statements anywhere, and everything has "pass" for each method.  ex:


def onMouseMoveMap(self, x, y, button, shift):
     pass

def onLine(self, line_geometry):
        array = arcpy.Array()
        part = line_geometry.getPart(0)
        for pt in part:
           array.add(pt)
         
        t_polygon = arcpy.Polygon(array)
        parea = t_polygon.area
        
        resSQFT = 0
        resAC = 0
        resHA = 0

        resSQFT = parea
        resAC = parea / 43560
        resHA = parea / 107639.104 
                  
        resSQFT = "%.2f" % resSQFT
        resAC = "%.2f" % resAC
        resHA = "%.2f" % resHA

        msg= "Total Area (SqFt): \n" + str(resSQFT) + "\n\n" + "Total Area (Acreage): \n" + str(resAC) + "\n\n" + "Total Area (Hecatares): \n" + str(resHA)
        pythonaddins.MessageBox(msg, 'Area Report', 0)


...etc


Any insight?  What is causing this?  How to supress this?

Outcomes