Periodically, you'll want to get the path to a file from the user. The tkinter library (which will look at in more detail soon) contains a class called filedialog that allows you to get the path to a file from the user. The code below will get the path to a file to open from the user.
# import Tkinter, Tkinter's FileDialog, the shapefile module, and os.path import tkinter import tkinter.filedialog # initialize Tkinter root = tkinter.Tk() # Get a full path to a shapefile from the user FilePath = tkinter.filedialog.askopenfilename(filetypes=[("allfiles","*")])
There is also an asksavefilename function to get the path to a file to save to.
© Copyright 2018 HSU - All rights reserved.