:right-sidebar: True DragIcon =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: DragIcon(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Native`, :class:`~gi.repository.Gtk.Root` ``GtkDragIcon`` is a ``GtkRoot`` implementation for drag icons. A drag icon moves with the pointer during a Drag-and-Drop operation and is destroyed when the drag ends. To set up a drag icon and associate it with an ongoing drag operation, use :obj:`~gi.repository.Gtk.DragIcon.get_for_drag` to get the icon for a drag. You can then use it like any other widget and use :obj:`~gi.repository.Gtk.DragIcon.set_child` to set whatever widget should be used for the drag icon. Keep in mind that drag icons do not allow user input. Methods ------- .. rst-class:: interim-class .. class:: DragIcon :no-index: .. method:: create_widget_for_value(value: ~typing.Any) -> ~gi.repository.Gtk.Widget | None Creates a widget that can be used as a drag icon for the given ``value``. Supported types include strings, ``GdkRGBA`` and ``GtkTextBuffer``. If GTK does not know how to create a widget for a given value, it will return :const:`None`. This method is used to set the default drag icon on drag-and-drop operations started by ``GtkDragSource``, so you don't need to set a drag icon using this function there. :param value: a ``GValue`` .. method:: get_child() -> ~gi.repository.Gtk.Widget | None Gets the widget currently used as drag icon. .. method:: get_for_drag(drag: ~gi.repository.Gdk.Drag) -> ~gi.repository.Gtk.Widget Gets the ``GtkDragIcon`` in use with ``drag``. If no drag icon exists yet, a new one will be created and shown. :param drag: a ``GdkDrag`` .. method:: set_child(child: ~gi.repository.Gtk.Widget | None = None) -> None Sets the widget to display as the drag icon. :param child: a ``GtkWidget`` .. method:: set_from_paintable(drag: ~gi.repository.Gdk.Drag, paintable: ~gi.repository.Gdk.Paintable, hot_x: int, hot_y: int) -> None Creates a ``GtkDragIcon`` that shows ``paintable``, and associates it with the drag operation. The hotspot position on the paintable is aligned with the hotspot of the cursor. :param drag: a ``GdkDrag`` :param paintable: a ``GdkPaintable`` to display :param hot_x: X coordinate of the hotspot :param hot_y: Y coordinate of the hotspot Properties ---------- .. rst-class:: interim-class .. class:: DragIcon :no-index: .. attribute:: props.child :type: ~gi.repository.Gtk.Widget The widget to display as drag icon.