save file python tkinter

Solutions on MaxInterview for save file python tkinter by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "save file python tkinter"
Gloria
07 Sep 2017
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)