mylouch

python scripting in arcmap 10

Discussion created by mylouch on May 2, 2014
Latest reply on May 3, 2014 by mylouch
Hello
I want to create a python script that do the same as the GO To XY but using a customized user interface. I start to write the interface code and creating the point but I don't know how can I display it in the map. Can you help me please.
Here is the code:
from Tkinter import *
class application(Frame):
    def __init__(self, master):
        Frame.__init__(self, master)
        self.grid()

        self.site_name= Label(self, text= " Site Name: ")
        self.site_name.grid()
        self.site_coordinate =Label(self, text='Site Coordinates : ')
        self.site_latitude= Label(self, text='Latitude: ')
        self.site_longitude= Label(self, text='Longitude: ')
        self.name=Entry(self, bg='white')
        self.latitude=Entry(self, bg='white')
        self.longitude= Entry(self,bg='white')
        self.site_name.grid(row=0)
        self.name.grid(row=1)
        self.site_coordinate.grid(row=2)
        self.site_longitude.grid(row=3)
        self.site_latitude.grid(row=3, column=2)
        self.longitude.grid (row=4)
        self.latitude.grid(row=4, column=2)
        self.ok_button = Button(self,text='Add', command=self.AddPoint)
        self.ok_button.grid(row=5, pady=30)
        self.cancel_button = Button(self,text='Cancel')
        self.cancel_button.grid(row=5, column=2)
       
    def AddPoint (self):
        latitude_value=self.latitude.get()
        longitude_value=self.longitude.get()
        inPoint = arcpy.Point(longitude_value, latitude_value)
       
    


root=Tk()
root.title ("Create Site")
app= application (root)
root.mainloop()
I there is any other possibilities such as using the ModelBuilder or a possiblity to edit the GO TO XY code and customize it please don't hesitate to tell me
Thank you in advance

Outcomes