Skip to content

DataTransfer

Represents some form of type-indexed possibly-lazy data transfer.

Used for accessing the platform clipboard and drag-and-drop APIs.

has_plaintext: bool

True if this DataTransfer advertises a plaintext representation.

has_image: bool

True if this DataTransfer advertises an image representation.

user_data: Optional[object]

Application-internal user data attached to this DataTransfer. Use this when the drag-and-drop or clipboard operation stays inside the current Python application and you want to avoid serializing to plaintext or an image.

Reading returns the Python object previously assigned, or None if none was set (or the user data was set by a non-Python binding). Assigning None clears any previously attached Python user data.

set_plaintext(text: str) -> None

Sets the plaintext representation of this DataTransfer. Calling this again overwrites the previous plaintext.

fetch_plaintext() -> Optional[str]

Returns the plaintext representation of this DataTransfer, or None if no plaintext is available.

set_image(image: Image) -> None

Sets the image representation of this DataTransfer. Calling this again overwrites the previous image.

fetch_image() -> Optional[Image]

Returns the image representation of this DataTransfer, or None if no image is available.


© 2026 SixtyFPS GmbH