Working with Python and Tkinter, I have been trying to find out the way to show the file_path beside the Browse Button but unable to do so.
Here is my code:
<
First, change this line:
Entry(f1, width=50, textvariable=file_path).grid(row=0,column=1,padx=2,pady=2,sticky='we',columnspan=25)
to this:
entry = Entry(f1, width=50, textvariable=file_path)
entry.grid(row=0,column=1,padx=2,pady=2,sticky='we',columnspan=25)
Then, in the open_file()
function, add these two lines, just before the return
:
entry.delete(0, END)
entry.insert(0, file_path)
Explanation:
First, we give the entry a name, so that it can be modified.
Then, in the open_file()
function we clear it and add the text for the file-path.