Why tkinter.filedialog.askdirectory isn't returning the full path (with the selected dirname)? Why tkinter.filedialog.askdirectory isn't returning the full path (with the selected dirname)? tkinter tkinter

Why tkinter.filedialog.askdirectory isn't returning the full path (with the selected dirname)?


The filedialog.askdirectory() method returns an instance of filedialog.Directory class that need a PyObject command:

enter image description here

The mere selection of a folder does not represent a command, thus you do not get printed the folder you want. By double clicking on the folder you want represents a satisfying and coherent PyObject command resulting in the result you expect.

In simple words: you need to double click on the folder you want to open, then click Ok and not simply select it and click on Ok on the file open dialog window. Otherwise, you will get printed the path of the directory where you are now (initialdir = '/')