duckduck10

Simple GUI??

Discussion created by duckduck10 on Mar 18, 2013
I am trying to create a GUI in python, even though I have read various times this is not really necessary and that the UI provided by arcgis is fine I think this case is an exception since I want to give the user the option to view the first couple of lines (in the GUI) of the data and redefine the field names for the data.

When running the script the user can select the file (using the UI arcgis provided ) and once the file is selected I would want the GUI that I have created to show up. So far I have managed to do this by placing my GUI in the Validation section of the updateParameters function of the Script Properties ..and it manages to do the proper job, until I click "OK" to run the script. It just seems like it wants to continue running the GUI and it continues to pop up. ANY HELP IS APPRICIATE IT!


Heres a snippet of what the code sort of looks like:

  def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parmater
    has been changed."""
    
      
    def fetch():
      self.params[1].value = entry.get()
      root.destroy()

    #parameter 0: the location of the file
    if self.params[0].altered: 

        
        #Accessing the first 4 lines of a file 
####......


        #GUI to provide the user with the found data
        root = Tk()
        root.title(string = "File ")
        frame = Frame(root)
        frame.pack()

        info = "Data: \n\n" + str(data)
        summary = Label(frame, text = info)
        summary.pack()

        entry_info = Label(frame, text = "\n\nFields:")
        entry_info.pack()

        entry = Entry(frame)
        entry.pack()

        button = Button(frame, text = "OK", command = fetch )
        button.pack()
        

        root.mainloop()
              
    
    return

Outcomes