Choosing a file in Python3
You need to import filedialog first, you can do it as follows:
from tkinter import *
from tkinter import filedialog
root = Tk()
root.filename = filedialog.askopenfilename(initialdir = "/", title = "Select file")
print (root.filename)
root.mainloop()
You can try something like this:
from tkinter import *
root = Tk()
root.filename = filedialog.askopenfilename(initialdir = "E:/Images",title = "choose your file",filetypes = (("jpeg files","*.jpg"),("all files","*.*")))
print (root.filename)
root.withdraw()
You're looking for tkinter.filedialog
as noted in the docs.
from tkinter import filedialog
You can look at what methods/classes are in filedialog
by running help(filedialog)
in the python interpreter. I think filedialog.LoadFileDialog
is what you're looking for.