]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-59396: Modernize tkinter.simpledialog (GH-151848)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 23 Jun 2026 08:01:10 +0000 (11:01 +0300)
committerGitHub <noreply@github.com>
Tue, 23 Jun 2026 08:01:10 +0000 (11:01 +0300)
commitad38cf82926c0bf41a677da39f0007f77eb6fc3f
treeffa3537988726c37bd5e4124d7d5b9e9af41c5f6
parent868d9a82cab556a8f5ad1f54e81d39dd325d3f52
gh-59396: Modernize tkinter.simpledialog (GH-151848)

Rework SimpleDialog and Dialog to match the look and feel of the native Tk
dialogs ::tk_dialog and ::tk::MessageBox.

* SimpleDialog is a Python port of ::tk_dialog and Dialog a base class
  modelled on ::tk::MessageBox.  Both adopt the message-box keyboard
  conventions: button accelerators, a default ring that follows the keyboard
  focus, and a <Return> binding that invokes the focused button.
* Both classes gain a use_ttk parameter that selects the classic Tk or the
  themed ttk widgets.  It controls the widget set and the appearance that the
  two procedures style differently, but not the keyboard behaviour.
* Update _place_window with the Tk 9.1 placement refinements.
* The new helpers _temp_grab_focus (a modal grab/focus context manager),
  _underline_ampersand and _find_alt_key_target (ports of the Tk
  accelerator-key procedures) can be reused by other tkinter dialogs, as
  _setup_dialog already is.
* Fix several defects uncovered while comparing with the Tcl sources.
* Improve the simpledialog demo.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Doc/library/dialog.rst
Doc/whatsnew/3.16.rst
Lib/test/test_tkinter/test_simpledialog.py
Lib/tkinter/simpledialog.py
Misc/NEWS.d/next/Library/2026-06-20-22-55-22.gh-issue-59396.kT9wPq.rst [new file with mode: 0644]