Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Python GUI save a file (filedialog) 💾
Play lesson

Python tkinter tutorial for beginners 🐍 - Python GUI save a file (filedialog) 💾

5.0 (2)
22 learners

What you'll learn

This course includes

  • 5.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Python GUI filedialog tkinter save a file tutorial for beginners #Python #GUI #save #filedialog #tkinter #file #tutorial #beginners from tkinter import * from tkinter import filedialog def saveFile(): file = filedialog.asksaveasfile(initialdir="C:\\Users\\Cakow\\PycharmProjects\\Main", defaultextension='.txt', filetypes=[ ("Text file",".txt"), ("HTML file", ".html"), ("All files", ".*"), ]) if file is None: return filetext = str(text.get(1.0,END)) #filetext = input("Enter some text I guess: ") //use this if you want to use console window file.write(filetext) file.close() window = Tk() button = Button(text='save',command=saveFile) button.pack() text = Text(window) text.pack() window.mainloop()

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere