tkinter filedialog filetypes code example
Example 1: python tkinter filedialog
from tkinter import filedialog
# Where it open to. # What the window is called. # What file types the user can choose between. first one is the defualt. (("what ever", "*.format"), ("what ever 2", "*.format2"))
filedialog.askopenfilename(initialdir=os.path.normpath("C://"), title="Example", filetypes =(("PNG", "*.png"),("JPG", "*.jpg"),("All Files","*.*")))
Example 2: tkinter filedialog how to show more than one filetype
from tkinter import filedialog
# To show multiple file types at the same time you need to
# seperate the types with a space
filedialog.askopenfilename(filetypes=[("Excel files", ".xlsx .xls")])