3

I'm trying to make a wx.lib.filebrowsebutton.FileBrowseButton button match both txt and csv files, but it doesn't seem to support glob pattern as described, *.{txt,csv} ends up matching nothing on windows and it literally tries to look for files with extension of {txt,csv}.

So how do I make it work for both txt and csv files?

Shane
  • 4,875
  • 12
  • 49
  • 87

1 Answers1

3

The documentation is not very clear. You should be using a semi-colon inside parenthesis, like so: "TXT and CSV files (*.txt; *.csv)|*.txt; *.csv"

You can also add a second line like so: "TXT and CSV files (*.txt; *.csv)|*.txt; *.csv|PNG files (*.png)|*.png"

pedram
  • 2,931
  • 3
  • 27
  • 43
  • Yes! semi-colon it is!! Thanks a lot mate!! – Shane Aug 28 '13 at 14:09
  • By the way where do you find the related docs or maybe you just checked the source to figure out how it works? – Shane Aug 28 '13 at 14:14
  • 1
    wxPython docs are here: http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.FileDialog.html. wx.FileDialog is well documented but some of the newer wxPython widgets like the filebrowsebutton are not as well documented. For those, I usually go to the source if I can. – pedram Aug 28 '13 at 14:25
  • Thanks again! Turns out I was looking at the wrong place all the time and trying to figure out a solution with several combinations... – Shane Aug 28 '13 at 14:37