简体   繁体   English

如何让用户将文件保存在目录中?

[英]How to let a user save a file in a directory?

I am trying to create a "save as" button using tkinter.我正在尝试使用 tkinter 创建一个“另存为”按钮。 For that, I want to let the user choose a directory and a name for the file.为此,我想让用户选择文件的目录和名称。 The file will be a dictionary converted into a json file.该文件将是一个转换为 json 文件的字典。 I understand that I can create a browse button for it using filedialog.askdirectory but the problem is, I dont know how can I let the user choose the name of his save file.我知道我可以使用 filedialog.askdirectory 为其创建一个浏览按钮,但问题是,我不知道如何让用户选择他的保存文件的名称。 Does anyone know how to do that?有谁知道这是怎么做到的吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM