Skip to content

gh-43699: Defer the drag cursor in tkinter.dnd until the pointer moves - #152371

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:tkinter-dnd-cursor
Jul 5, 2026
Merged

gh-43699: Defer the drag cursor in tkinter.dnd until the pointer moves#152371
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:tkinter-dnd-cursor

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

The drag cursor was applied to the source widget as soon as the button was pressed, in DndHandler.__init__(). As a result a plain click (a press and release with no motion) briefly flashed the drag cursor, even though no drag-and-drop actually took place.

The cursor is now changed only once the pointer has moved past a small threshold, so that a plain click no longer flashes it. This matches BWidget's pure-Tcl drag-and-drop, which likewise shows drag feedback only after a few pixels of motion.

The original report also proposed making the drag cursor configurable. That part is intentionally left out: neither BWidget nor the native tkdnd package (the intended eventual replacement for this module) exposes a cursor option, so a configurable-cursor parameter would be a tkinter.dnd-only knob with no precedent and no successor. An application that wants its own cursor can already set it from the drag-and-drop callbacks.

This is a behavior change with no new API, so it targets the main branch only.

…r moves
The drag cursor is now changed only once the pointer starts moving past
a small threshold rather than on the initial button press, so that a
plain click no longer flashes it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts:
#	Lib/test/test_tkinter/test_dnd.py
@serhiy-storchaka
serhiy-storchaka merged commit 8f06112 into python:mainJul 5, 2026
92 of 95 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the tkinter-dnd-cursor branch July 5, 2026 12:49
Sign up for freeto 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

@serhiy-storchaka