[Tutor] tkinter.filedialog?

Jim Byrnes jf_byrnes at comcast.net
Wed Jun 25 15:35:30 CEST 2014


On 06/25/2014 02:36 AM, Alan Gauld wrote:
> 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

OK, I see it now, thanks.  I guess I am conditioned to seeing a downward 
pointing arrow head or triangle to indicate a drop down list, didn't 
even pay attention to the little rectangle at the right of the control.

Regards,  Jim



More information about the Tutor mailing list