How to let a user save a file in a directory?
Question:
I am trying to create a "save as" button using 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. 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.
Does anyone know how to do that?
Answers:
You can use filedialog.asksaveasfilename()
.
I am trying to create a "save as" button using 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. 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.
Does anyone know how to do that?
You can use filedialog.asksaveasfilename()
.