In tkinter in python 3.4, how to create folder using askdirectory dialog?
from tkinter import filedialog
filedialog.askdirectory(initialdir="/tmp/test")
This shows choos directory window, but cant see option to create new folder. For example, /tmp/test/new_folder. usually choose directory window have button to make new folder, but cant find option in tkinter.
I wish Tkinter included a New Folder button on the Linux platform, but it doesn't seem to. The best I could do was to just type the new folder name in the text field, and then create the new folder after the dialog box closes.
def process_files(self):
savedir = tkFileDialog.askdirectory(title='Select folder to save results')
os.makedirs(savedir)
# Now write some files into savedir.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With