I want to make a Python script that will calculate the distance of the line I drew and output it in a special form, but I can't figure out what I'm doing wrong.
import arcpy
import pythonaddins
class ToolClass2(object):
"""Implementation for probn_addin.tool (Tool)"""
def __init__(self):
self.enabled = True
self.shape = "Line" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.
def onMouseDown(self, x, y, button, shift):
pass
def onMouseDownMap(self, x, y, button, shift):
print(x,y)
return(x,y)
def onMouseUp(self, x, y, button, shift):
pass
def onMouseUpMap(self, x, y, button, shift):
print(x,y)
return(x,y)
def onMouseMove(self, x, y, button, shift):
pass
def onMouseMoveMap(self, x, y, button, shift):
pass
def onDblClick(self):
pass
def onKeyDown(self, keycode, shift):
pass
def onKeyUp(self, keycode, shift):
pass
def deactivate(self):
pass
def onCircle(self, circle_geometry):
pass
def onLine(self, line_geometry):
onMouseDownMap(x1,y1)
onMouseUpMap(x2,y2)
dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
message = "Your lenght:" + str(dist)
pythonaddins.MessageBox(message, "Ruler")
def onRectangle(self, rectangle_geometry):
pass