[英]How do I get the path of a file I want to upload by a file entry?
I want to upload a file by a file entry and then when I click on "Save" I want to get the path of this selected file. 我想通过文件条目上传文件,然后单击“保存”时,我要获取此选定文件的路径。
The next step would be to create either a .txt
or a yaml
file with this path in it as output. 下一步将是创建一个
.txt
或yaml
文件,并在其中将此路径作为输出。
Could someone help me with this? 有人可以帮我吗?
win.addFileEntry("InputFile")
def press(button):
if button == "Exit":
win.stop()
if button == "Save":
print(path._getfullpathname(__file__))
print("Saved!")
win.addButtons(["Add", "Remove", "Save", "Load", "Exit"], press)
您只需要向FileEntry询问其内容: filename = win.getEntry('InputFile')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.