Skip to content

gh-153550: Modernize the older prose sections of the tkinter documentation#153647

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
serhiy-storchaka:gh-153550-modernize-tkinter-prose
Jul 15, 2026
Merged

gh-153550: Modernize the older prose sections of the tkinter documentation#153647
serhiy-storchaka merged 3 commits into
python:mainfrom
serhiy-storchaka:gh-153550-modernize-tkinter-prose

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

Follow-up of gh-86726, closing gh-153550.

The tkinter reference sections were overhauled in gh-86726 and #153549, but the narrative prose preceding them — Tkinter life preserver and Handy reference in Doc/library/tkinter.rst, plus the tkinter.ttk front matter — still read like a late-1990s tutorial. This is an editorial pass to match. No API changes.

tkinter.rst

  • Replace The packer with a general Geometry management section covering grid, pack and place, with an example and use case for each, grid as the default, and a warning against mixing pack and grid in one container.
  • Rework The window manager and Coupling widget variables: modern Tk()/ttk examples instead of the dated App(Frame) idiom, and correct explanations (e.g. a widget links to a Variable because Python can't notify Tk when a plain variable is reassigned).
  • Drop the Ousterhout page-number citations for the relevant Tk man pages; reconcile the Packer options and Tk option data types lists with the reference; fill in the empty Entry-index list; point classic examples at the ttk widgets.

tkinter.ttk.rst

  • Lead the intro with the native-theme benefit; fix the TIP 48 link; recommend the explicit from tkinter import ttk form; refresh the theme-engine links (ttk::intro + the illustrated Tile Widget Set paper); add cross-references to tkinter.rst.

tkinter.dnd.rst

  • Fix the malformed target-selection list and mark up source/event as parameters.

Docs-only; no Misc/NEWS.d entry.

…cumentation

Refresh the narrative "Tkinter life preserver" and "Handy reference"
sections to match the overhauled reference (pythongh-86726 and pythongh-153549).

* Rework "The packer" into a general "Geometry management" section that
  covers grid, pack and place, with a short example and use case for
  each, presents grid as the flexible default, and warns against mixing
  pack and grid in one container.  Add symmetric cross-links between the
  Grid, Pack and Place reference classes and this section.
* Rework "The window manager": explain what the window manager is, state
  that the Wm mixin is inherited by Tk and Toplevel so its methods are
  called directly on a top-level window, and replace the dated
  App(Frame) example (which reached the window through master) with a
  direct Tk() example.  Drop the private _root() aside and cross-link
  the section and the Wm reference class to each other.
* Rework "Coupling widget variables": explain that a widget links to a
  Variable object rather than a plain Python variable because Python
  cannot notify Tk when a variable is reassigned, and replace the dated
  App(Frame) example (whose entry was attached to the wrong parent) with
  a direct ttk example showing both get() and set().
* Remove the page-number citations to Ousterhout's book and point to the
  relevant Tk man pages instead.
* Refresh the Tcl/Tk links in tkinter.ttk: add the official ttk::intro
  man page as the current explanation of the theme engine, keep Joe
  English's illustrated 2004 "Tile Widget Set" paper for its element and
  layout diagrams, and drop the now-redundant conversion monograph.
* Modernize the tkinter.ttk front matter: lead the introduction with the
  native-theme benefit instead of peripheral features, update the TIP 48
  link to its canonical URL, and add a note recommending the explicit
  "from tkinter import ttk" form over the star-import override.
* Add cross-references between the two documents: point the tkinter.ttk
  introduction at the shared concepts documented for tkinter, and link
  the themed-widgets note in the tkinter introduction to tkinter.ttk.
* Reconcile the "Packer options" and "Tk option data types" lists with
  the reference: replace the incomplete packer list with a cross-link to
  Pack.pack_configure, and frame the data-types list as the shared value
  types the reference refers to.
* Fill in the empty Entry index list under "The index parameter", and
  describe "@6" as a string rather than an integer.
* Point the classic base-widget examples at the themed ttk widgets.
* Fix the malformed target-selection list in tkinter.dnd: make it a
  single ordered list with the sub-steps nested under the search step,
  and mark up "source" and "event" as parameters.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@read-the-docs-community

read-the-docs-community Bot commented Jul 13, 2026

Copy link
Copy Markdown

@serhiy-storchaka serhiy-storchaka marked this pull request as ready for review July 13, 2026 07:46
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 13, 2026
Renaming the "The packer" section to "Geometry management" and folding
away the "Packer options" subsection removed their implicit HTML ids,
breaking existing deep links.  Restore both as explicit targets on the
new section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly ignored sphinx formatting, focusing on content. Many chunks are improved. Only a few suggestions.

Comment thread Doc/library/tkinter.rst Outdated
Comment thread Doc/library/tkinter.rst
Comment thread Doc/library/tkinter.rst Outdated
@bedevere-app

bedevere-app Bot commented Jul 15, 2026

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

…etry docs

Address review comments: forward-reference the grid/pack warning from the
geometry managers intro, and mention that frames and toplevels are
containers too (toplevels being managed by the window manager).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again.

@bedevere-app

bedevere-app Bot commented Jul 15, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@bedevere-app bedevere-app Bot requested a review from terryjreedy July 15, 2026 05:37
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

I merged suggestions on my side because they needed re-wraping the lines.

@serhiy-storchaka serhiy-storchaka merged commit 93beea7 into python:main Jul 15, 2026
35 of 38 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jul 15, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the gh-153550-modernize-tkinter-prose branch July 15, 2026 16:19
@bedevere-app

bedevere-app Bot commented Jul 15, 2026

Copy link
Copy Markdown

GH-153773 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 15, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 93beea7e5a3c5a03253e6812a06f2497505aeb30 3.13

@bedevere-app

bedevere-app Bot commented Jul 15, 2026

Copy link
Copy Markdown

GH-153774 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 15, 2026
@serhiy-storchaka serhiy-storchaka removed their assignment Jul 15, 2026
serhiy-storchaka added a commit that referenced this pull request Jul 15, 2026
…ocumentation (GH-153647) (GH-153774)

Refresh the narrative "Tkinter life preserver" and "Handy reference"
sections to match the overhauled reference (gh-86726 and gh-153549).

* Rework "The packer" into a general "Geometry management" section
  covering grid, pack and place, and cross-link it with the Grid, Pack
  and Place reference classes.
* Rework "The window manager" and "Coupling widget variables", replacing
  the dated App(Frame) examples with direct Tk() and ttk examples.
* Replace page-number citations to Ousterhout's book with links to the
  relevant Tk man pages.
* Modernize the tkinter.ttk front matter and its Tcl/Tk links, and add
  cross-references between the two documents.
* Reconcile the "Packer options" and "Tk option data types" lists with
  the reference, and fill in the empty Entry index list.
* Fix the malformed target-selection list in tkinter.dnd.
(cherry picked from commit 93beea7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
serhiy-storchaka added a commit that referenced this pull request Jul 15, 2026
…ocumentation (GH-153647) (GH-153773)

Refresh the narrative "Tkinter life preserver" and "Handy reference"
sections to match the overhauled reference (gh-86726 and gh-153549).

* Rework "The packer" into a general "Geometry management" section
  covering grid, pack and place, and cross-link it with the Grid, Pack
  and Place reference classes.
* Rework "The window manager" and "Coupling widget variables", replacing
  the dated App(Frame) examples with direct Tk() and ttk examples.
* Replace page-number citations to Ousterhout's book with links to the
  relevant Tk man pages.
* Modernize the tkinter.ttk front matter and its Tcl/Tk links, and add
  cross-references between the two documents.
* Reconcile the "Packer options" and "Tk option data types" lists with
  the reference, and fill in the empty Entry index list.
* Fix the malformed target-selection list in tkinter.dnd.
(cherry picked from commit 93beea7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bedevere-app

bedevere-app Bot commented Jul 15, 2026

Copy link
Copy Markdown

GH-153775 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 15, 2026
serhiy-storchaka added a commit that referenced this pull request Jul 15, 2026
…ocumentation (GH-153647) (GH-153775)

Refresh the narrative "Tkinter life preserver" and "Handy reference"
sections to match the overhauled reference (gh-86726 and gh-153549).

* Rework "The packer" into a general "Geometry management" section
  covering grid, pack and place, and cross-link it with the Grid, Pack
  and Place reference classes.
* Rework "The window manager" and "Coupling widget variables", replacing
  the dated App(Frame) examples with direct Tk() and ttk examples.
* Replace page-number citations to Ousterhout's book with links to the
  relevant Tk man pages.
* Modernize the tkinter.ttk front matter and its Tcl/Tk links, and add
  cross-references between the two documents.
* Reconcile the "Packer options" and "Tk option data types" lists with
  the reference, and fill in the empty Entry index list.
* Fix the malformed target-selection list in tkinter.dnd.


(cherry picked from commit 93beea7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants