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()
# Button : Open
open = tk.Button(root, text = "Open", command = open_file_chooser)
# Starting the Application


You have selected : C:/Users/Dinesh/Desktop/example.jpg

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *