How it works...

The asksaveasfile function accepts the same optional parameters as the askopenfile function, but also allows you to add the file extension by default with the defaultextension option.

To prevent users from accidentally overriding previous files, this dialog automatically warns you if you try to save a new file with the same name as an existing one.

With the file object, we can write the contents of the Text widget—always remember to close the file to free the resources taken by the object:

contents = self.text.get(1.0, tk.END)
new_file.write(contents)
new_file.close()
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset