I have to perform an operation on several directories.
TKinter offers a dialog for opening one file (askopenfilename), and several files (askopenfilenames), but is lacking a dialog for several directories.
What is the quickest way to get to a feasible solution for "askdirectories"?
Unfortunately, tkinter doesn't natively support this. A nice looking alternative is tkfilebrowser. Code based on Luke's answer using tkfilebrowser is below:
import tkfilebrowser
from tkinter import *
root = Tk()
root.geometry('200x200')
root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)
dirs = []
def get_directories():
dirs.append(tkfilebrowser.askopendirnames())
return dirs
b1 = Button(root, text='select directories...', command=get_directories)
b1.pack()
root.mainloop()