I am trying to make a simple GUI using Tkinter in python2, in which I need to make an entry box and a button besides that. The button browses the file and shows the filepath in the entrybox. How can I do that.
I used the tkFileDialog.askopenfilename
that allows to browse the path but how can I make the gui to show that path in an entry box.
I tried it as follows:
import tkinter as tk
import tkFileDialog
root=tk.Tk()
def browsefunc():
filename =tkFileDialog.askopenfilename(filetypes=(("tiff files","*.tiff"),("All files","*.*")))
ent1=tk.Entry(frame,font=40)
ent1.grid(row=2,column=2)
b1=tk.Button(frame,text="DEM",font=40,command=browsefunc)
b1.grid(row=2,column=4)
root.mainloop()