[Tkinter-discuss] tkinter file dialog pattern matching

Pawel Mosakowski pawel at mosakowski.net
Sat Aug 22 22:04:24 CEST 2015


Hi,

I've found this little gem in the Tk docs
https://www.tcl.tk/man/tcl8.4/TkCmd/getOpenFile.htm#M13
From what I see "file patterns" in the file dialog are not "regex
patterns" and do not support special characters. Only things that work
are:
1) * - any extension
2) "" - files without extension
3) literal extension without wildcard chars
Unfortunately it looks like there is no simple way to filter out hidden
files.
Check out this answer
https://mail.python.org/pipermail//tutor/2011-November/086483.html

Regards,
Pawel Mosakowski

On Sat, 22 Aug 2015 13:03:46 +0200
Laura Creighton <lac at openend.se> wrote:

> Somebody on the tutor mailing list wants to match
> "all files and direcories in this directory that do not start
> with a ."
> 
> The filetypes option seems only to want patterns to match, not
> patterns to exclude.  Is my pattern matching magic just off, or
> is there no way to exclude things in a tkFileDialog?
> 
> puzzled,
> Laura
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> https://mail.python.org/mailman/listinfo/tkinter-discuss



More information about the Tkinter-discuss mailing list