:right-sidebar: True EventControllerScroll =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: EventControllerScroll(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.EventController`, :class:`~gi.repository.GObject.Object` ``GtkEventControllerScroll`` is an event controller that handles scroll events. It is capable of handling both discrete and continuous scroll events from mice or touchpads, abstracting them both with the :obj:`~gi.repository.Gtk.EventControllerScroll.signals.scroll` signal. Deltas in the discrete case are multiples of 1. In the case of continuous scroll events, ``GtkEventControllerScroll`` encloses all :obj:`~gi.repository.Gtk.EventControllerScroll.signals.scroll` emissions between two :obj:`~gi.repository.Gtk.EventControllerScroll.signals.scroll_begin` and :obj:`~gi.repository.Gtk.EventControllerScroll.signals.scroll_end` signals. The behavior of the event controller can be modified by the flags given at creation time, or modified at a later point through :obj:`~gi.repository.Gtk.EventControllerScroll.set_flags` (e.g. because the scrolling conditions of the widget changed). The controller can be set up to emit motion for either/both vertical and horizontal scroll events through :const:`~gi.repository.Gtk.EventControllerScrollFlags.VERTICAL`, :const:`~gi.repository.Gtk.EventControllerScrollFlags.HORIZONTAL` and :const:`~gi.repository.Gtk.EventControllerScrollFlags.BOTH_AXES`. If any axis is disabled, the respective :obj:`~gi.repository.Gtk.EventControllerScroll.signals.scroll` delta will be 0. Vertical scroll events will be translated to horizontal motion for the devices incapable of horizontal scrolling. The event controller can also be forced to emit discrete events on all devices through :const:`~gi.repository.Gtk.EventControllerScrollFlags.DISCRETE`. This can be used to implement discrete actions triggered through scroll events (e.g. switching across combobox options). The :const:`~gi.repository.Gtk.EventControllerScrollFlags.KINETIC` flag toggles the emission of the :obj:`~gi.repository.Gtk.EventControllerScroll.signals.decelerate` signal, emitted at the end of scrolling with two X/Y velocity arguments that are consistent with the motion that was received. Constructors ------------ .. rst-class:: interim-class .. class:: EventControllerScroll :no-index: .. classmethod:: new(flags: ~gi.repository.Gtk.EventControllerScrollFlags) -> ~gi.repository.Gtk.EventController Creates a new event controller that will handle scroll events. :param flags: flags affecting the controller behavior Methods ------- .. rst-class:: interim-class .. class:: EventControllerScroll :no-index: .. method:: get_flags() -> ~gi.repository.Gtk.EventControllerScrollFlags Gets the flags conditioning the scroll controller behavior. .. method:: get_unit() -> ~gi.repository.Gdk.ScrollUnit Gets the scroll unit of the last :obj:`~gi.repository.Gtk.EventControllerScroll.signals.scroll` signal received. Always returns %GDK_SCROLL_UNIT_WHEEL if the :const:`~gi.repository.Gtk.EventControllerScrollFlags.DISCRETE` flag is set. .. versionadded:: 4.8 .. method:: set_flags(flags: ~gi.repository.Gtk.EventControllerScrollFlags) -> None Sets the flags conditioning scroll controller behavior. :param flags: flags affecting the controller behavior Properties ---------- .. rst-class:: interim-class .. class:: EventControllerScroll :no-index: .. attribute:: props.flags :type: ~gi.repository.Gtk.EventControllerScrollFlags The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: EventControllerScroll.signals :no-index: .. method:: decelerate(vel_x: float, vel_y: float) -> None The type of the None singleton. :param vel_x: X velocity :param vel_y: Y velocity .. method:: scroll(dx: float, dy: float) -> bool The type of the None singleton. :param dx: X delta :param dy: Y delta .. method:: scroll_begin() -> None The type of the None singleton. .. method:: scroll_end() -> None The type of the None singleton.