non-blocking getkey?
Terry Reedy
tjreedy at udel.edu
Wed Nov 18 07:26:12 EST 2015
On 11/18/2015 6:01 AM, Ulli Horlacher wrote:
> Ulli Horlacher <framstag at rus.uni-stuttgart.de> wrote:
>
>> it is too complicated to rewrite my application from CLI to GUI.
>> But... is there a windows program with which one can select files and the
>> result is written to STDOUT?
>
> Found it:
>
> from Tkinter import Tk
> from tkFileDialog import askopenfilename
>
> Tk().withdraw()
> file = askopenfilename()
To get multiple names, add 's'. On Windows, one uses control-leftclick
to get multiple names. Don't know about other systems.
>>> fd.askopenfilenames() # ^click 4 names
('F:/Python/dev/27/Lib/idlelib/aboutDialog.py',
'F:/Python/dev/27/Lib/idlelib/AutoComplete.py',
'F:/Python/dev/27/Lib/idlelib/AutoCompleteWindow.pyc',
'F:/Python/dev/27/Lib/idlelib/Bindings.py')
The limitation is that this will not work if any of the file names
contain astral (non-BMP) chars because tk cannot handle such characters.
--
Terry Jan Reedy
More information about the Python-list
mailing list