Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Sep 25, 2020
Embed
What would you like to do?
def save_file():
"""Save the current file as a new file."""
filepath = asksaveasfilename(
defaultextension="txt",
filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")],
)
if not filepath:
return
with open(filepath, "w") as output_file:
text = txt_edit.get("1.0", tk.END)
output_file.write(text)
window.title(f"Thecleverprogrammer - {filepath}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment