Selecting a file in a directory

vsoler vicente.soler at gmail.com
Sat Feb 13 20:38:40 EST 2010


On Feb 14, 2:28 am, "Alf P. Steinbach" <al... at start.no> wrote:
> * vsoler:
>
> > Hi,
>
> > My python script needs to work with a .txt file in a directory. I
> > would like to give the user the possibility to choose the file he
> > needs to work on in as much the same way as I open a .xls file in
> > Excel, that is, I want to make appear the "Windows'" window and let
> > the user choose.
>
> > I think this should be quite straightforward.
>
> > How should I proceed?
>
> At least in Windows one easy way is to delegate that responsibility to the
> Windows shell. When a user drags a file onto your script, your script is run
> with the path to that dragged file as argument. Or it can even be multiple files.
>
> Otherwise, tkinter has, as I recall, a standard file chooser dialog.
>
> These "standard" dialogs are generally called "common dialogs".
>
> Just google for tkinter and suitable words.
>
> Cheers & hth.,
>
> - Alf

I'll try, thank you very much



More information about the Python-list mailing list