-
Notifications
You must be signed in to change notification settings - Fork 11
Description
In tkFileBrowser it is necessary to specify file filters as e.g. filefilter=[("FITS files", "*.fit|*.fits"), ("All files", "*.*")] whereas the same filter for a standard tk filedialog would be filefilter=[("FITS files", "*.fit *.fits"), ("All files", "*.*")]
(The separator between multiple file extensions is a | instead of a space.)
This makes it much more awkward to use as a drop-in replacement. (My use case is that I'm writing a cross-platform script, and I'm quite happy with the way TK uses the native filedialogs on Windows and Mac, but on Linux the TK filedialog is astonishingly ugly and slow, so I want to use tkFileBrowser as a replacement on Linux but leave the native filedialogs on the other OSes. It should be a matter of:
if sys.platform.startswith("linux"):
import tkfilebrowser as filedialog
else:
from tkinter import filedialog
but it's made more complicated than it needs to be owing to have to handle the filter specifications differently.