I'm making a program that you use the askopenname file dialog to select a file, which I then want to save the directory to a string so I can use another function (which I already made) to extract the file to a different location that is predetermined. My button code that opens the file dialog is this:
`a = tkinter.Button(gui, command=lambda: tkinter.filedialog.askopenfilename(initialdir='C:/Users/%s' % user))`
This should be what you want:
If you know where the file actually is, you could always just ask for a directory instead of the file using:
Then in the code: