Python GUI Tutorial - 42 -FileDialogbox , asksaveasfile

Tech-Gram Academy
Tech-Gram Academy
11.7 هزار بار بازدید - 6 سال پیش - in this video you're going
in this video you're going to learn how we can save a file (text file) using save as filedialogbox.
filedialogboxes are present in tkinter and also filedialogbox are very easy to use in tkinter.
and the package that we'll use to open filedialogbox is "from tkinter import filedialogbox"

so here is the code -

from tkinter import *
from tkinter import filedialog

def save_file():
   f = filedialog.asksaveasfile(mode='w', defaultextension=".txt")
   if f is None:
       return

   f.write("hello how are you!!!!!!!!")
   f.close()

root = Tk()

button = Button(root, text="save as", command=save_file)
button.pack()
root.geometry("300x300")
root.mainloop()
---------------------------------------------------------------------------

so i am sure your queries like -
1.how to use save as filedialogbox in tkinter?
2. how to open save as dialog box in tkinter?
3. how to open filedialogbox to open a file?
4. save a text file using fildialogbox in tkinter's save as file dialog box.

have  been solved.

if you have any query related to this video, then please comment below, we'll reply as soon as possible-

contact us -

facebook - Facebook: programmingcage
Email - [email protected]
6 سال پیش در تاریخ 1397/05/21 منتشر شده است.
11,701 بـار بازدید شده
... بیشتر