On 11/18/2015 6:01 AM, Ulli Horlacher wrote:
Ulli Horlacher <frams...@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

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to