cpython/Lib/test/test_tkinter
Serhiy Storchaka ad38cf8292
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>
2026-06-23 11:01:10 +03:00
..
__init__.py gh-65784: Add support for parametrized resource wantobjects in regrtests (GH-143570) 2026-01-16 18:38:38 +02:00
__main__.py
README
support.py gh-65784: Add support for parametrized resource wantobjects in regrtests (GH-143570) 2026-01-16 18:38:38 +02:00
test_colorchooser.py gh-65784: Add support for parametrized resource wantobjects in regrtests (GH-143570) 2026-01-16 18:38:38 +02:00
test_dnd.py gh-151678: Add tests for tkinter.dnd (GH-151780) 2026-06-20 16:08:55 +03:00
test_filedialog.py gh-151678: Add tests for tkinter.filedialog (GH-151781) 2026-06-20 13:21:19 +00:00
test_font.py gh-151678: Add tests for tkinter font, image, variable, Misc and Wm methods (GH-151751) 2026-06-19 22:45:47 +00:00
test_geometry_managers.py gh-151678: Add tests for tkinter Misc, Wm and geometry manager methods (GH-151732) 2026-06-19 17:38:32 +03:00
test_images.py gh-151890: Support more photo image options in tkinter.PhotoImage methods (GH-151891) 2026-06-22 16:35:39 +00:00
test_loadtk.py gh-65784: Add support for parametrized resource wantobjects in regrtests (GH-143570) 2026-01-16 18:38:38 +02:00
test_messagebox.py gh-65784: Add support for parametrized resource wantobjects in regrtests (GH-143570) 2026-01-16 18:38:38 +02:00
test_misc.py gh-75666: Fix a reference leak in tkinter event bindings (GH-151808) 2026-06-23 06:59:25 +03:00
test_scrolledtext.py gh-151678: Add tests for tkinter.scrolledtext (GH-151753) 2026-06-19 23:39:34 +00:00
test_simpledialog.py gh-59396: Modernize tkinter.simpledialog (GH-151848) 2026-06-23 11:01:10 +03:00
test_text.py gh-151675: Add tkinter Text.sync() and Text.pendingsync() (GH-151677) 2026-06-20 17:11:21 +03:00
test_variables.py gh-151678: Add tests for tkinter font, image, variable, Misc and Wm methods (GH-151751) 2026-06-19 22:45:47 +00:00
test_widgets.py gh-101284: Allow passing Menubutton options to tkinter.OptionMenu (GH-151959) 2026-06-23 06:24:17 +00:00
widget_tests.py gh-145736: Fix Tkinter tests for Tk 8.7, 9.0 and 9.1 (GH-145738) 2026-03-11 21:01:03 +02:00

Writing new tests
=================

Precaution
----------

    New tests should always use only one Tk window at once, like all the
    current tests do. This means that you have to destroy the current window
    before creating another one, and clean up after the test. The motivation
    behind this is that some tests may depend on having its window focused
    while it is running to work properly, and it may be hard to force focus
    on your window across platforms (right now only test_traversal at
    test_ttk.test_widgets.NotebookTest depends on this).