From: spro96 <ss...@ya...> - 2010-04-02 16:14:56
|
Hello all, Is there a way to specify an arbitrary filter for the filetype using tk_getOpenFile? I would like to filter the files that appear in the file browser window by looking for an arbitrary string in the file name, not just by looking for files with a particular extension. Specifically, when Tk opens up the file browser window, I'd like one of the "Types of Files" pulldown menu options to be "*out.txt" where the "out" is not actually an extension, just part of the name of the file. So the files that would be listed would be sample1-out.txt, sample2out.txt, out.txt, etc., but not sample3.txt. I tried the following: set fileTypes = { {"Output files" {out.txt}} {"All text files" {.txt} } set fname [tk_getOpenFile -filetypes $fileTypes] but this doesn't have the desired behavior. In the "Open" dialogue box, the "Files of Type" pulldown menu lists the following: Output files (out.txt) All text files (*.txt) There are no files available when the Files of Type is set to "Output files (out.txt)". (One interesting fact is that there is no asterisk by "out.txt" as there is with "*.txt" suggesting that at the very least, a file named "out.txt" would be listed. However, even if I do have a file explicitly named out.txt, it does not appear in the file list. I don't really care about that, though--it still wouldn't help me accomplish my real goal of listing all the "*out.txt" files.) Please let me know how one can accomplish filtering like this. Thank you! Steve -- View this message in context: http://old.nabble.com/Arbitrary-filters-for-filetype-in-tk_getOpenFile-tp28120597p28120597.html Sent from the tcl-core mailing list archive at Nabble.com. |