1from tkinter import filedialog
2from tkinter import *
3
4win = Tk()
5filename = filedialog.asksaveasfilename(initialdir='/', title='Save File', filetypes=(('Text Files', 'txt.*'), ('All Files', '*.*')))
6textContent = "I'm the text in the file"
7myfile = open(filename, "w+")
8myfile.write(textContent)
9# to test
10print("File saved as ", filename)