Display Path of a file in Tkinter using "browse" Button - Python [duplicate] Display Path of a file in Tkinter using "browse" Button - Python [duplicate] tkinter tkinter

Display Path of a file in Tkinter using "browse" Button - Python [duplicate]


This is so easy -- you need to assign the path to a variable and then print it out:

from tkinter import *root = Tk()def browsefunc():    filename = filedialog.askopenfilename()    pathlabel.config(text=filename)browsebutton = Button(root, text="Browse", command=browsefunc)browsebutton.pack()pathlabel = Label(root)pathlabel.pack()

P.S.: This is in Python 3. But the concept is same.