tk - askopenfilenames parsing

daku9999 at daku9999 at
Mon Apr 6 01:43:26 CEST 2009


I'm having trouble with the output from askopenfilenames...:


root = tkinter.Tk()
    files = tkinter.filedialog.askopenfilenames(parent=root,
       title='Choose file(s)')
    if not files:
        tkinter.messagebox.showerror("No input file", "No input file

I'm using "filenames" because I want to handle the opening and closing
of the files myself.   But I'm having trouble with what 'files' is, as
it appears to be a string with a space between each path/filename
(when choosing multiple files not in the directory that it is run in,
e.g. when I browse to a different directory and grab files).

tryin: for filenames in files.split() works as long as there are no
directories containing spaces in the names (unlikely).

How does one go about parsing the return from askopenfilenames?

I'm just trying to let the user select multiple files for some batch
parsing and then letting the script happily loop through each one.

Any help would be appreciated.


More information about the Python-list mailing list