# fileDialogOptions.py
# Purpose: Vary file dialog options to get file and directory
#          names from user and print the results.
# Usage: No script arguments required.
import tkinter.filedialog

t = ("shapefiles ", "*.shp")
print('Type = {0}'.format(type(t)))

fname1 = tkinter.filedialog.askopenfilename(filetypes=[t])
print('fname1 = {0}'.format(fname1))

fname2 = tkinter.filedialog.askopenfilename(title='Test 2 filetypes',
                                      filetypes=[("csv (Comma delimited) ", "*.csv"),("Text Files ", "*.txt")])
print('fname2 = {0}'.format(fname2))

fname3 = tkinter.filedialog.askopenfilename(title='Test initialdir', initialdir='C:/gispy')

print('fname3 = {0}'.format(fname3))

fname4 = tkinter.filedialog.askopenfilename(title='Test initialfile', initialfile='bogus.shp')

print('fname4 = {0}'.format(fname4))

fnames = tkinter.filedialog.askopenfilename(title='Test multiple selections allowed', multiple=True)

print('Name list:')
for fname in fnames:  # For each file selected by the user,...
    print('\t{0}'.format(fname))

inputDir = tkinter.filedialog.askdirectory(title='Test mustexist =True', mustexist=True)
print('inputDir = {0}'.format(inputDir))