[Tutor] tkinter.filedialog?

Alan Gauld alan.gauld at btinternet.com
Wed Jun 25 09:36:44 CEST 2014


On 25/06/14 02:37, Jim Byrnes wrote:

>  >>> import tkinter.filedialog
>  >>> filetypes = [("Python files", "*.py"), ("Text files", "*.txt")]
>  >>> fileName = tkinter.filedialog.askopenfilename(filetypes = filetypes)
>
> It pops up a file dialog but again only .py files are shown.
>
> Why is it that both .py and .txt files are not shown?

filetypes does not control which files are shown it controls which 
filters are shown. There is a drop down list on the dialog that you can 
select the filter that is applied. You should find there are two in your 
case: Python files and text files.

If you select the text files filter it will show only text files...


hth
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list