DragTarget
Examples#
See these.
Inherits: Control
A control that completes drag operation when a Draggable control
is dropped.
When a Draggable is dragged on top of a DragTarget, the DragTarget is asked
whether it will accept the data the Draggable is carrying. The DragTarget will
accept incoming drag if it belongs to the same group as Draggable. If the user
does drop the Draggable on top of the DragTarget (and the DragTarget has
indicated that it will accept the Draggable's data), then the DragTarget is
asked to accept the Draggable's data.
Properties
Events
-
on_accept(EventHandler[DragTargetEvent] | None) –Called when the user does drop an acceptable (same
group) draggable on -
on_leave(EventHandler[DragTargetLeaveEvent] | None) –Called when a draggable leaves this target.
-
on_move(EventHandler[DragTargetEvent] | None) –Called when a draggable moves within this target.
-
on_will_accept(EventHandler[DragWillAcceptEvent] | None) –Called when a draggable is dragged on this target.
Properties#
group
class-attribute
instance-attribute
#
group: str = 'default'
The group this target belongs to.
Note
For a DragTarget to accept an incoming drop from a Draggable,
they must both be in the same group.
Events#
on_accept
class-attribute
instance-attribute
#
on_accept: EventHandler[DragTargetEvent] | None = None
Called when the user does drop an acceptable (same group) draggable on
this target.
Use page.get_control(e.src_id) to retrieve Control reference by its ID.
on_leave
class-attribute
instance-attribute
#
on_leave: EventHandler[DragTargetLeaveEvent] | None = None
Called when a draggable leaves this target.
on_move
class-attribute
instance-attribute
#
on_move: EventHandler[DragTargetEvent] | None = None
Called when a draggable moves within this target.
on_will_accept
class-attribute
instance-attribute
#
on_will_accept: EventHandler[DragWillAcceptEvent] | None = (
None
)
Called when a draggable is dragged on this target.