admin管理员组文章数量:1305771
I'm using tkinter askdirectory to get a user selected folder name in Win 10.
For a directory called 'Documents Nig 30Jan2025' the code returns D:/Documents
for a directory on a usb attached drive. For other directories on the drive it returns the full directory name, eg
'Zipped folder 1'. If I rename the Documents folder eg to 'Documentx Nig 30Jan2025' the code still returns
D:/Documents
.
The code is :
from tkinter import filedialog as fd
from tkinter import Tk
dirOptions = {"title": "Select Directory","mustexist": True}
root = Tk(); root.withdraw()
folder = r'{}'.format(fd.askdirectory(**dirOptions))
print("folder - ",folder)
root.destroy()
I can't find why this is happening. Would appreciate how to get the full folder name. Thanks.
I tried selecting other folder names on the C and D drive and they all show the correct folder name.your text
本文标签: pythontkinter askdirectory not returning correct nameStack Overflow
版权声明:本文标题:python - tkinter askdirectory not returning correct name - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741810383a2398758.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论