Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

save file python tkinter

from tkinter import filedialog
from tkinter import *

win = Tk()
filename = filedialog.asksaveasfilename(initialdir='/', title='Save File', filetypes=(('Text Files', 'txt.*'), ('All Files', '*.*')))
textContent = "I'm the text in the file"
myfile = open(filename, "w+")
myfile.write(textContent)
# to test
print("File saved as ", filename)
Comment

save file python tkinter

from tkinter import filedialog
from tkinter import *

win = Tk()
filename = filedialog.asksaveasfilename(initialdir='/', title='Save File', filetypes=(('Text Files', 'txt.*'), ('All Files', '*.*')))
textContent = "I'm the text in the file"
myfile = open(filename, "w+")
myfile.write(textContent)
# to test
print("File saved as ", filename)
Comment

PREVIOUS NEXT
Code Example
Python :: how to wait in python 
Python :: pygame how to make a transparent surface 
Python :: epoch to datetime python 
Python :: python program to shutdown computer when user is not present 
Python :: python split string by tab 
Python :: numpy read image 
Python :: convert json to x-www-form-urlencoded pyhon 
Python :: How to generate the power set of a given set, in Python? 
Python :: python sort dictionary alphabetically by key 
Python :: dataframe from two series 
Python :: install mamba conda 
Python :: join list with comma python 
Python :: display Max rows in a pandas dataframe 
Python :: python how to set the axis ranges in seaborn 
Python :: model load pytorch 
Python :: save machine learning model python 
Python :: python duplicate file 
Python :: concat dataFrame without index reset 
Python :: ignore warning sklearn 
Python :: django today date in template 
Python :: python random 
Python :: check cuda version pytorch 
Python :: flask if statement 
Python :: save numpy array to csv 
Python :: unban discord.py 
Python :: extract first letter of column python 
Python :: python create map with coordinates 
Python :: matplotlib show imaginary numbers 
Python :: valueerror expected 2d array got 1d array instead python linear regression 
Python :: python read entire file as string 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =