-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaveas.py
More file actions
26 lines (21 loc) · 761 Bytes
/
saveas.py
File metadata and controls
26 lines (21 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from tkinter import *
from tkinter import filedialog
def saveFile():
file = filedialog.asksaveasfile(initialdir='',
title='Save file okay?',
defaultextension='.txt',
filetypes=[('text files','*.txt'),
('all files','*.*')
]
)
filetext = str(text.get(1.0,END))
# filetext = input('Enter some text I guess: ')
file.write(filetext)
file.close()
window = Tk()
window.title('A filedialogsaveas case')
text = Text()
text.pack()
button = Button(text='Save',command=saveFile)
button.pack()
window.mainloop()