File dialogs help you open, save files or directories. This is the type of dialog you get when you click file,open. This dialog comes out of the module, there’s no need to write all the code manually.

Tkinter does not have a native looking file dialog, instead it has the customer tk style. You can see these below.

The file dialog will work on all desktop platforms.

Related course:
Python Desktop Apps with Tkinter
icon

file dialogs

tkinter filedialog

The tkinter filedialog comes in several types. Which type you need really depends on your applications needs. All of them are methods calls.

You can open a single file, a directory, save as file and much more.

1
2
3
4
5
6
7
8
9
import tkinter.filedialog

tkinter.filedialog.asksaveasfilename()
tkinter.filedialog.asksaveasfile()
tkinter.filedialog.askopenfilename()
tkinter.filedialog.askopenfile()
tkinter.filedialog.askdirectory()
tkinter.filedialog.askopenfilenames()
tkinter.filedialog.askopenfiles()

tkinter filedialog