pyface.i_drop_handler module

class pyface.i_drop_handler.IDropHandler(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]

Bases: Interface

Interface for a drop event handler, which provides API to check if the drop can be handled or not, and then handle it if possible.

can_handle_drop(event, target)[source]

Whether or not a drag event can be handled

This is used to give feedback to the user about whether a drop is possible via the shape of the cursor or similar indicators.

Parameters
  • event (drag event) – A drag event with information about the object being dragged.

  • target (toolkit widget) – The widget that would be dropped on.

Returns

can_drop – True if the current drop handler can handle the given drag event occurring on the given target widget.

Return type

bool

handle_drop(event, target)[source]

Performs drop action when drop event occurs on target widget.

Parameters
  • event (drop event) – A drop event with information about the object being dropped.

  • target (toolkit widget) – The widget that would be dropped on