0

I noticed that even if you set your wildcard to match *.txt files only, all wx.FileDialog does is list all txt files under that directory, still you can input any existent file with a different extension and hit open button without having any problem at all?

There doesn't seem to exist a window style to avoid this from happening, so I guess you have to validate the file extension yourself, right? Interesting, does this count as a bug?

Shane
  • 4,875
  • 12
  • 49
  • 87

1 Answers1

1

This is not exclusive to wxPython and is not a bug. Try this in any Windows application and you will see you can save a txt file as a .exe in Notepad or open a .png file in MS Word. A file extension is just a convention, which means it can be broken for any number of reasons. If you are confident that you must check the file extension of a file, you will need to perform some validation with the return value of the wx.FileDialog.

pedram
  • 2,931
  • 3
  • 27
  • 43