Hello everyone, In this example, you will learn how to bring file chooser using Tkinter in Python. The example program has been tested and shared in the same post.
Example Program
import tkinter as tk from tkinter.filedialog import askopenfilename # defining open_file_chooser function def open_file_chooser(): filename = askopenfilename() print("You have selected : %s" % filename) # creating an instance of Tk root = tk.Tk() root.title("Example") # Button : Open open = tk.Button(root, text = "Open", command = open_file_chooser) open.pack() # Starting the Application root.mainloop()
Output
You have selected : C:/Users/Dinesh/Desktop/example.jpg


More from my site

Hello, folks, I am a founder of idineshkrishnan.com. I love open source technologies, If you find my tutorials are useful, please consider making donations to these charities.
No responses yet