Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-153550: Modernize the older prose sections of the tkinter document…
…ation (GH-153647)

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>
  • Loading branch information
2 people authored and miss-islington committed Jul 15, 2026
commit c999d57e34a77a3e3d711e5a0353f3caae489d5f
19 changes: 10 additions & 9 deletions Doc/library/tkinter.dnd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@ a single application, within the same window or between windows. To enable an
object to be dragged, you must create an event binding for it that starts the
drag-and-drop process. Typically, you bind a ButtonPress event to a callback
function that you write (see :ref:`Bindings-and-Events`). The function should
call :func:`dnd_start`, where 'source' is the object to be dragged, and 'event'
call :func:`dnd_start`, where *source* is the object to be dragged, and *event*
is the event that invoked the call (the argument to your callback function).

Selection of a target object occurs as follows:

#. Top-down search of area under mouse for target widget
#. Top-down search of the area under the mouse for a target widget:

* Target widget should have a callable *dnd_accept* attribute
* If *dnd_accept* is not present or returns ``None``, search moves to parent widget
* If no target widget is found, then the target object is ``None``
* the target widget should have a callable *dnd_accept* attribute;
* if *dnd_accept* is not present or returns ``None``,
the search moves to the parent widget;
* if no target widget is found, the target object is ``None``.

2. Call to *<old_target>.dnd_leave(source, event)*
#. Call to *<new_target>.dnd_enter(source, event)*
#. Call to *<target>.dnd_commit(source, event)* to notify of drop
#. Call to *<source>.dnd_end(target, event)* to signal end of drag-and-drop
#. Call to ``<old_target>.dnd_leave(source, event)``.
#. Call to ``<new_target>.dnd_enter(source, event)``.
#. Call to ``<target>.dnd_commit(source, event)`` to notify of the drop.
#. Call to ``<source>.dnd_end(target, event)`` to signal the end of drag-and-drop.


.. class:: DndHandler(source, event)
Expand Down
Loading
Loading