S or /

SourceClass DragAndDrop

from egui import DragAndDrop
class DragAndDrop:

Plugin for tracking drag-and-drop payload.

This plugin stores the current drag-and-drop payload internally and handles automatic cleanup when the drag operation ends (via Escape key or mouse release).

This is a low-level API. For a higher-level API, see: - egui.Ui.dnd_drag_source - egui.Ui.dnd_drop_zone - egui.Response.dnd_set_drag_payload - egui.Response.dnd_hover_payload - egui.Response.dnd_release_payload

This is a built-in plugin in egui, automatically registered during Context creation.

See this example.

Methods§

Source@staticmethod def clear_payload(ctx: Context) -> None§

Clears the payload, setting it to None.

Source@staticmethod def has_any_payload(ctx: Context) -> bool§

Are we carrying a payload?

Returns True both during a drag and on the frame the pointer is released (if there is a payload).

Source@staticmethod def has_payload_of_type(ctx: Context) -> bool§

Are we carrying a payload of the given type?

Returns True both during a drag and on the frame the pointer is released (if there is a payload).

Source@staticmethod def payload(ctx: Context) -> Any |None§

Retrieve the payload, if any.

Returns None if there is no payload, or if it is not of the requested type.

Returns Some both during a drag and on the frame the pointer is released (if there is a payload).

Source@staticmethod def set_payload(ctx: Context, payload: Any) -> None§

Set a drag-and-drop payload.

This can be read by egui.DragAndDrop.payload until the pointer is released.

Source@staticmethod def take_payload(ctx: Context) -> Any |None§

Retrieve and clear the payload, if any.

Returns None if there is no payload, or if it is not of the requested type.

Returns Some both during a drag and on the frame the pointer is released (if there is a payload).