That code would have worked fine in Python 2.x, but it is no longer valid. In Python 3.x, tkFileDialog was renamed to filedialog and placed inside the Tkinter package. Nowadays, you import it like so:
import tkinter.filedialog
# or
from tkinter import filedialog
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With