examples icon indicating copy to clipboard operation
examples copied to clipboard

funtion move_on_top() doesn't work in example solitaire

Open 15921483570 opened this issue 8 months ago • 0 comments

flet version: 0.28.3 python version: 3.9.6 OS: mac m1(12.7.6) , android

I'm writing a demo after this tutorial:

https://flet.dev/docs/tutorials/python-solitaire#summary

until Step 3: Adding a second card.

funtion move_on_top() doesn't work using the code from the link below this part

https://github.com/flet-dev/examples/blob/main/python/tutorials/solitaire/solitaire-drag-and-drop/step3.py

i.e, the green card is still under the yellow one.

is there any changes? or should I update any control?

key code:

def move_on_top(card, controls):
    """Moves draggable card to the top of the stack"""
    controls.remove(card)
    controls.append(card)
    page.update()

def start_drag(e: ft.DragStartEvent):
    move_on_top(e.control, controls)
    solitaire.start_top = e.control.top
    solitaire.start_left = e.control.left

15921483570 avatar May 29 '25 14:05 15921483570