Skip to content

gh-59396: Use themed widgets in tkinter.filedialog#152036

Open
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:tkinter-filedialog-use-ttk
Open

gh-59396: Use themed widgets in tkinter.filedialog#152036
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:tkinter-filedialog-use-ttk

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

The FileDialog, LoadFileDialog and SaveFileDialog dialogs, which follow the layout of the classic Motif file selection dialog, are now built from the themed tkinter.ttk widgets by default instead of the classic tkinter widgets, and gained a use_ttk parameter that selects between the classic Tk widgets and the themed ttk widgets.

They were also brought closer to the native Tk file dialog: the buttons and field labels gained Alt key accelerators, the default ring follows the keyboard focus and the previous focus and grab are restored on close, the Escape key cancels the dialog, the focus traverses the widgets in their visual order, and the directory and file lists gained a horizontal scrollbar and type-ahead selection. The dialog is now transient and centered over its parent, and the SaveFileDialog overwrite confirmation uses a themed message box.

This is the filedialog counterpart of the simpledialog modernization in gh-59396 (#151848); the button and frame metrics follow tk_dialog (classic) and tk::MessageBox (themed), while the body keeps the Motif layout.

The Listbox stays classic in both modes, as ttk has no themed listbox; a Treeview-based list is left as a possible follow-up.

The FileDialog, LoadFileDialog and SaveFileDialog dialogs are now built from
the themed tkinter.ttk widgets by default instead of the classic tkinter
widgets, and gained a use_ttk parameter that selects between the classic Tk
widgets and the themed ttk widgets.

They were also brought closer to the native Tk file dialog: the buttons and
field labels gained Alt key accelerators, the default ring follows the keyboard
focus, the Escape key cancels the dialog, the focus traverses the widgets in
their visual order, and the directory and file lists gained a horizontal
scrollbar and type-ahead selection.  The dialog is now transient and centered
over its parent, and the SaveFileDialog overwrite confirmation uses a themed
message box.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@read-the-docs-community

read-the-docs-community Bot commented Jun 23, 2026

Copy link
Copy Markdown

filedialog no longer imports tkinter.dialog, so that submodule is not
always present when run.py undoes idlelib's tkinter imports; skip the
ones that are missing instead of raising.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant