I want to select files and folders with filedialog
in Tkinter(Python). I try using askdirectory
and askopenfilenames
. But I can't find a special dialog in documentation.
https://docs.python.org/3/library/dialog.html
This is my sample code:
root = tk.Tk()
root.withdraw()
# one way
files_and_directories = filedialog.askopenfilenames(parent=root, title="Select files and folders", multiple=True)
# another way
files_and_directories = filedialog.askdirectory(parent=root, title='Select files and folders', multiple=True)
The problem is that askopenfilenames
and askdirectory
don't return a list with the files and the folders that I select.