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

Viewed 10019

I'm trying to get the full path of a directory selected via tkinter.filedialog.askdirectory, but it only returns the path of the root folder, for example, selection the folder /root will return only '/', this seems strange, how to get it return the full path in python3.5?

import tkinter as tk from tkinter import filedialog

root = tk.Tk()
root.withdraw()
dirname = filedialog.askdirectory(parent=root,initialdir="/",title='Please select a directory')
if len(dirname ) > 0:
    print("You chose %s" % dirname)
1 Answers
Related