tubeshowcase●1,182,839 videos♡ My collection 0
← Learn to Code

Learn to Code07:38

Python GUI open a file (filedialog) 📁

Bro Code ↗

From the creator

Python GUI filedialog tkinter open a file tutorial for beginners #Python #GUI #filedialog #tkinter #open #file #tutorial #beginners from tkinter import * from tkinter import filedialog def openFile(): filepath = filedialog.askopenfilename(initialdir="C:\\Users\\Cakow\\PycharmProjects\\Main", title="Open file okay?", filetypes= (("text files","*.txt"), ("all files","*.*"))) file = open(filepath,'r') print(file.read()) file.close() window = Tk() button = Button(text="Open",command=openFile) button.pack() window.mainloop()

Published 2020-08-10 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code