I've been using easygui for opening files and other tasks on my project and generally it works great. When using the fileopenbox, however, I am not able to get it to show only files of a certain type.
In the code snippet below I was expecting to get a listing of only *.csv files but it gives me everything in the directory. I worry this is a bit inconvenient for users, and would like to be able to filter that for ease of use.
import easygui as eg
infile = eg.fileopenbox(msg='Please locate the csv file',
title='Specify File', default='c:\data\det\*.csv')
refdata = pd.read_csv(infile)
Now, what I do get is close. In the bottom of the file open dialog, where you can select file type, it is preloaded with only two choices : all files (.) and csv files (*.csv) so my setting of the default parameter seems to be doing something, it just stops a bit short of what I want it to do (which is to filter the list to make it easier for the user).
Appreciate any tips on how to do that. If there's a way to do it that doesn't involve easygui, that's a good solution too as far as I'm concerned.
This should do it.
import easygui as eg
infile = eg.fileopenbox(msg='Please locate the csv file',
title='Specify File', default='c:\data\det\*.csv',
filetypes='*.csv')
refdata = pd.read_csv(infile)