Re: Display Files in Directory
Prahlad Yeri via Tkinter-discuss <[email protected]> Tue, 12 Sep 2017 09:21:58 +0530
| Newsgroups | gmane.comp.python.tkinter |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 11 Sep 2017 10:44:07 -0500 Austin Redding <[email protected]> wrote: > I'm attempting to use 'askdirectory' in order to populate a widget > with the relevant files in the user selected directory. However, > when using 'askdirectory' the user isn't able to see the files inside > the directory, unlike 'askopenfilename' which displays all the files. It appears from your question that your objective is to create a way for the user to be able to select multiple file(s) through a single dialog that shows all files/folders, so that they don't have to select each file/folder individually. Is this requirement correct? If so, then you can use the filedialog.askopenfilenames (with an s in the end) that is able to do exactly this: from tkinter import filedialog files = filedialog.askopenfilenames(parent=self.master,title='Choose the Music file(s)', filetypes=(("xml files", "*.xml"))) I'd used this code in one of my projects where the user wanted to select multiple xml files for processing by using one single browse button. Hope this helps. -- Regards, Prahlad