1

I want to choose a directory(folder) while using the askopenfilename interface, because I think the interface of askopenfilename is more convenient and more clear for users to choose. Could anybody help me figure out? askdirectory interface
askopenfilename interface

from tkinter import filedialog

filename = filedialog.askopenfilename()  # preferred interface, but I can't choose a folder
directoryname = filedialog.askdirectory()
print(filename)
print(directoryname)
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • There's nothing to figure out. `askopenfilename` is for picking files. If you need to pick directories your only choice is `askdirectory` or make your own dialog. – Bryan Oakley Apr 29 '16 at 16:45
  • 1
    what do you mean by making my own dialog? – Zhengxia QIN May 01 '16 at 12:41
  • I think what Bryan meant is explained here: https://stackoverflow.com/questions/36224235/how-can-i-use-the-same-dialog-box-in-tkinter-to-browse-and-select-files-and-dire – hahnec Feb 22 '19 at 12:00

0 Answers0