fix: replace deprecated delta_x/delta_y with local_delta.x/y in examples and docs#6344
Open
Krishnachaitanyakc wants to merge 1 commit intoflet-dev:mainfrom
Open
Conversation
…les and docs DragUpdateEvent no longer has delta_x/delta_y attributes. All solitaire tutorial examples, the gesture_detector mouse_cursors example, and the solitaire tutorial documentation now use the correct e.local_delta.x and e.local_delta.y properties from the Offset object. Fixes flet-dev#6317
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Flet’s Python solitaire tutorial examples and related documentation to match the current DragUpdateEvent API by replacing removed delta_x/delta_y attributes with local_delta.x/local_delta.y, preventing AttributeError at runtime.
Changes:
- Replaced
e.delta_x/e.delta_ywithe.local_delta.x/e.local_delta.yacross solitaire tutorial examples. - Updated the
gesture_detector/mouse_cursors.pyexample to useevent.local_delta.x/y. - Aligned the solitaire tutorial documentation snippets with the updated drag event API.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/python/packages/flet/docs/tutorials/solitaire.md | Updates tutorial snippets to use local_delta.x/y for drag movement. |
| sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step1.py | Fixes drag handler to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step2.py | Fixes drag handler to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step3.py | Fixes drag handler to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-drag-and-drop/step4.py | Fixes drag handler to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-classes/card.py | Updates Card.drag() to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-fanned-piles/card.py | Updates pile dragging to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-game-setup/card.py | Updates pile dragging to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-game-rules/card.py | Updates pile dragging to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-final/card.py | Updates final tutorial drag logic to use local_delta. |
| sdk/python/examples/tutorials/solitaire/solitaire-final-part1/card.py | Updates drag logic to use local_delta. |
| sdk/python/examples/controls/gesture_detector/mouse_cursors.py | Fixes container dragging to use local_delta. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ndonkoHenri
approved these changes
Mar 25, 2026
Contributor
ndonkoHenri
left a comment
There was a problem hiding this comment.
lgtm, thanks for your contribution!
FeodorFitsner
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
e.delta_xande.delta_yattributes onDragUpdateEventwith the correcte.local_delta.xande.local_delta.yproperties across all solitaire tutorial examples, the gesture detector mouse cursors example, and the solitaire tutorial documentation.DragUpdateEventno longer exposesdelta_x/delta_y— these were replaced by thelocal_deltaOffsetobject (with.xand.yattributes), causing anAttributeErrorwhen running any of the affected examples.Fixes #6317
Files Changed (12 files)
Example code (11 .py files):
solitaire-drag-and-drop/step1.py,step2.py,step3.py,step4.pysolitaire-classes/card.pysolitaire-fanned-piles/card.pysolitaire-game-setup/card.pysolitaire-game-rules/card.pysolitaire-final/card.pysolitaire-final-part1/card.pygesture_detector/mouse_cursors.pyDocumentation (1 .md file):
docs/tutorials/solitaire.mdTest plan
step1.py) and verify that dragging a card works withoutAttributeErrormouse_cursors.pygesture detector example and verify dragging worksSummary by Sourcery
Update drag handling in solitaire tutorials and gesture detector example to use the current DragUpdateEvent local_delta API instead of removed delta_x/delta_y attributes.
Bug Fixes:
Documentation: