I am trying to get a Tkinter listbox to populate with an unknown filename that a user imports with a browse button. I am able to populate the listbox with "File has been uploaded" everytime a file is selected, although I want the filename(or path) to be displayed in the listbox. Here is what I have so far:
def browse():
openFile = filedialog.askopenfile(initialdir = '/', title="Select a File")
fileList.insert('end', "File has been uploaded")
return
browseButton = tk.Button(root, text="Browse", width=15, padx=10, pady=10, command=browse)
browseButton.grid(row=0, column=0)
fileList = tk.Listbox(root, height=15, width=50)
fileList.grid(row=2, column=0, columnspan=3)