Skip to content

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
Krishnachaitanyakc:fix/solitaire-demo-delta-api-update
Open

fix: replace deprecated delta_x/delta_y with local_delta.x/y in examples and docs#6344
Krishnachaitanyakc wants to merge 1 commit intoflet-dev:mainfrom
Krishnachaitanyakc:fix/solitaire-demo-delta-api-update

Conversation

@Krishnachaitanyakc
Copy link

@Krishnachaitanyakc Krishnachaitanyakc commented Mar 25, 2026

Summary

  • Replaces all usages of the removed e.delta_x and e.delta_y attributes on DragUpdateEvent with the correct e.local_delta.x and e.local_delta.y properties across all solitaire tutorial examples, the gesture detector mouse cursors example, and the solitaire tutorial documentation.
  • DragUpdateEvent no longer exposes delta_x/delta_y — these were replaced by the local_delta Offset object (with .x and .y attributes), causing an AttributeError when 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.py
  • solitaire-classes/card.py
  • solitaire-fanned-piles/card.py
  • solitaire-game-setup/card.py
  • solitaire-game-rules/card.py
  • solitaire-final/card.py
  • solitaire-final-part1/card.py
  • gesture_detector/mouse_cursors.py

Documentation (1 .md file):

  • docs/tutorials/solitaire.md

Test plan

  • Run any of the solitaire drag-and-drop step examples (e.g., step1.py) and verify that dragging a card works without AttributeError
  • Run the mouse_cursors.py gesture detector example and verify dragging works
  • Verify the solitaire tutorial documentation code snippets match the updated API

Summary 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:

  • Fix AttributeError in solitaire tutorial and gesture detector examples by replacing deprecated delta_x/delta_y with local_delta.x/local_delta.y in drag handlers.

Documentation:

  • Align solitaire tutorial documentation snippets with the updated DragUpdateEvent local_delta-based API.

…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
@CLAassistant
Copy link

CLAassistant commented Mar 25, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_y with e.local_delta.x/e.local_delta.y across solitaire tutorial examples.
  • Updated the gesture_detector/mouse_cursors.py example to use event.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.

Copy link
Contributor

@ndonkoHenri ndonkoHenri left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Solitaire Demo code uses wrong delta

5 participants