With Python Add-In Wizard I created a ButtonTool with which I:
- click in the map
- get the coordinates of the mouseclick-location in a dialog with textboxes
I want to receive the coordinates in a textbox to have the possibility to copy and paste the coordinate values (e.g. to use them in a document).
I get a crash between TKinter and arcpy like I read in some posts before. Nevertheless I want to ask, if anybody has experience with this and has a suggestion.
Here is my code:
Import Tkinter
class ToolCoord(object):
def __init__(self):
self.enabled = True
self.shape = "NONE"
self.cursor = 3
def onMouseDownMap(self, x, y, button, shift):
pt = arcpy.PointGeometry(arcpy.Point(x,y))
main = Tkinter.Tk()
lb = Tkinter.Label(main, text = "UTM-Koordinaten:")
lb.pack()
t1 = Tkinter.Text(main, width=20, height=0)
t1.insert("end", str(x))
t1.pack()
t2 = Tkinter.Text(main, width=20, height=0)
t2.insert("end", str(y))
t2.pack()
main.mainloop()