Skip to content

gh-71808: Rebuild IDLE query dialogs on tkinter.simpledialog.Dialog#152773

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-71808-query-simpledialog
Open

gh-71808: Rebuild IDLE query dialogs on tkinter.simpledialog.Dialog#152773
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-71808-query-simpledialog

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 1, 2026

Copy link
Copy Markdown
Member

idlelib.query.Query hand-rolled the modal-dialog machinery (transient window, grab, wait_window, OK/Cancel buttons, geometry) that tkinter.simpledialog.Dialog now provides. This rebuilds Query as a Dialog subclass:

  • create_widgets() becomes body(), and the buttons are dropped in favor of Dialog's standard buttonbox(). The query dialogs (Open Module, custom Run, new config-section / highlight-theme / key-set names, Help source) therefore gain Dialog's keyboard equivalents — <Return>, <Escape>, and Alt+underlined-letter button accelerators — and its default-button handling (IDLE: Add keyboard equivalents for mouse actions. #71807).
  • ok()'s validation moves to validate(); ok/cancel/transient/grab/wait_window are inherited.
  • The entry_ok validation API and all five subclasses are preserved, as are IDLE's <KP_Enter> and macOS <Command-.> bindings and the non-resizable geometry.
  • The widgets and paddings follow the style of tkinter.simpledialog (ttk widgets, 2m paddings, sticky fills).

A private Dialog._show_modal() seam is added so Query can suppress the modal wait when unit testing; it is a behavior-preserving refactor of the tail of Dialog.__init__.

Main-only: it depends on the themed (use_ttk) Dialog, which is not in the maintenance branches.

…alog

Subclass Dialog instead of reimplementing its modal machinery.  The query
dialogs gain its keyboard equivalents -- <Return>, <Escape>, and
Alt-underlined-letter button accelerators (pythongh-71807).
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