- filedialog
- askopenfilename
Simple file dialog
This is another way of using the Tk widgets. Here we have a plain command-line script, but instead of using the
standard input() function of Python to ask for a filename it launches a Tk File-dialog widget to allow the user to browse
and select a file.
examples/tk/simple_file_dialog.py
from tkinter import filedialog input_file_path = filedialog.askopenfilename(filetypes=(("Excel files", "*.xlsx"), ("CSV files", "*.csv"), ("Any file", "*"))) print(input_file_path) input("Press ENTER to end the script...")