DropControllerMotion

class DropControllerMotion(**properties: Any)

Superclasses: EventController, Object

GtkDropControllerMotion is an event controller tracking the pointer during Drag-and-Drop operations.

It is modeled after EventControllerMotion so if you have used that, this should feel really familiar.

This controller is not able to accept drops, use DropTarget for that purpose.

Constructors

class DropControllerMotion
classmethod new() EventController

Creates a new event controller that will handle pointer motion events during drag and drop.

Methods

class DropControllerMotion
contains_pointer() bool

Returns if a Drag-and-Drop operation is within the widget self or one of its children.

get_drop() Drop | None

Returns the GdkDrop of a current Drag-and-Drop operation over the widget of self.

is_pointer() bool

Returns if a Drag-and-Drop operation is within the widget self, not one of its children.

Properties

class DropControllerMotion
props.contains_pointer: bool

Whether the pointer of a Drag-and-Drop operation is in the controller’s widget or a descendant.

See also is_pointer.

When handling crossing events, this property is updated before enter, but after leave is emitted.

props.drop: Drop

The ongoing drop operation over the controller’s widget or its descendant.

If no drop operation is going on, this property returns None.

The event controller should not modify the drop, but it might want to query its properties.

When handling crossing events, this property is updated before enter, but after leave is emitted.

props.is_pointer: bool

Whether the pointer is in the controllers widget itself, as opposed to in a descendent widget.

See also contains_pointer.

When handling crossing events, this property is updated before enter, but after leave is emitted.

Signals

class DropControllerMotion.signals
enter(x: float, y: float) None

Signals that the pointer has entered the widget.

Parameters:
  • x – coordinates of pointer location

  • y – coordinates of pointer location

leave() None

Signals that the pointer has left the widget.

motion(x: float, y: float) None

Emitted when the pointer moves inside the widget.

Parameters:
  • x – the x coordinate

  • y – the y coordinate