Basic Drag
Drag from one point to another:Parameters
| Parameter | Type | Description |
|---|---|---|
from_point | tuple/Point | Starting coordinates |
to_point | tuple/Point | Ending coordinates |
Hold and Drag
For operations that require holding before dragging (like reordering):Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
from_point | tuple/Point | required | Starting coordinates |
to_point | tuple/Point | required | Ending coordinates |
hold_duration_ms | int | 500 | Time to hold before dragging |
Use Cases
Reorder List Items
Adjust a Slider
Move an App Icon
Drag to Delete
Pull to Refresh
Combining with Coordinates
Use with bounding boxes from vision models:Tips
Use hold_and_drag for reordering
Use hold_and_drag for reordering
When reordering items in a list, use
hold_and_drag with at least 500ms hold time. This gives the UI time to recognize the drag operation.Adjust hold duration for different apps
Adjust hold duration for different apps
Some apps require longer hold times before allowing drag. Start with 500ms and increase if the drag doesn’t work.
Drag to edges carefully
Drag to edges carefully
When dragging to screen edges, ensure your end coordinates are within bounds using
screen.clamp().