:right-sidebar: True Adjustment =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: Adjustment(*args, **kwargs) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` ``GtkAdjustment`` is a model for a numeric value. The ``GtkAdjustment`` has an associated lower and upper bound. It also contains step and page increments, and a page size. Adjustments are used within several GTK widgets, including :obj:`~gi.repository.Gtk.SpinButton`, :obj:`~gi.repository.Gtk.Viewport`, :obj:`~gi.repository.Gtk.Scrollbar` and :obj:`~gi.repository.Gtk.Scale`. The ``GtkAdjustment`` object does not update the value itself. Instead it is left up to the owner of the ``GtkAdjustment`` to control the value. Constructors ------------ .. rst-class:: interim-class .. class:: Adjustment :no-index: .. classmethod:: new(value: float, lower: float, upper: float, step_increment: float, page_increment: float, page_size: float) -> ~gi.repository.Gtk.Adjustment Creates a new ``GtkAdjustment``. :param value: the initial value :param lower: the minimum value :param upper: the maximum value :param step_increment: the step increment :param page_increment: the page increment :param page_size: the page size Methods ------- .. rst-class:: interim-class .. class:: Adjustment :no-index: .. method:: clamp_page(lower: float, upper: float) -> None Updates the value property to ensure that the range between ``lower`` and ``upper`` is in the current page. The current page goes from ``value`` to ``value`` + ``page-size``. If the range is larger than the page size, then only the start of it will be in the current page. A :obj:`~gi.repository.Gtk.Adjustment.signals.value_changed` signal will be emitted if the value is changed. :param lower: the lower value :param upper: the upper value .. method:: configure(value: float, lower: float, upper: float, step_increment: float, page_increment: float, page_size: float) -> None Sets all properties of the adjustment at once. Use this function to avoid multiple emissions of the :obj:`~gi.repository.Gtk.Adjustment.signals.changed` signal. See :obj:`~gi.repository.Gtk.Adjustment.set_lower` for an alternative way of compressing multiple emissions of :obj:`~gi.repository.Gtk.Adjustment.signals.changed` into one. :param value: the new value :param lower: the new minimum value :param upper: the new maximum value :param step_increment: the new step increment :param page_increment: the new page increment :param page_size: the new page size .. method:: get_lower() -> float Retrieves the minimum value of the adjustment. .. method:: get_minimum_increment() -> float Gets the smaller of step increment and page increment. .. method:: get_page_increment() -> float Retrieves the page increment of the adjustment. .. method:: get_page_size() -> float Retrieves the page size of the adjustment. .. method:: get_step_increment() -> float Retrieves the step increment of the adjustment. .. method:: get_upper() -> float Retrieves the maximum value of the adjustment. .. method:: get_value() -> float Gets the current value of the adjustment. .. method:: set_lower(lower: float) -> None Sets the minimum value of the adjustment. When setting multiple adjustment properties via their individual setters, multiple :obj:`~gi.repository.Gtk.Adjustment.signals.changed` signals will be emitted. However, since the emission of the :obj:`~gi.repository.Gtk.Adjustment.signals.changed` signal is tied to the emission of the ::notify signals of the changed properties, it’s possible to compress the :obj:`~gi.repository.Gtk.Adjustment.signals.changed` signals into one by calling :func:`~gi.repository.GObject.GObject.Object.freeze_notify` and :func:`~gi.repository.GObject.GObject.Object.thaw_notify` around the calls to the individual setters. Alternatively, using a single :func:`~gi.repository.GObject.GObject.Object.set` for all the properties to change, or using :obj:`~gi.repository.Gtk.Adjustment.configure` has the same effect. :param lower: the new minimum value .. method:: set_page_increment(page_increment: float) -> None Sets the page increment of the adjustment. See :obj:`~gi.repository.Gtk.Adjustment.set_lower` about how to compress multiple emissions of the :obj:`~gi.repository.Gtk.Adjustment.signals.changed` signal when setting multiple adjustment properties. :param page_increment: the new page increment .. method:: set_page_size(page_size: float) -> None Sets the page size of the adjustment. See :obj:`~gi.repository.Gtk.Adjustment.set_lower` about how to compress multiple emissions of the :obj:`~gi.repository.Gtk.Adjustment.signals.changed` signal when setting multiple adjustment properties. :param page_size: the new page size .. method:: set_step_increment(step_increment: float) -> None Sets the step increment of the adjustment. See :obj:`~gi.repository.Gtk.Adjustment.set_lower` about how to compress multiple emissions of the :obj:`~gi.repository.Gtk.Adjustment.signals.changed` signal when setting multiple adjustment properties. :param step_increment: the new step increment .. method:: set_upper(upper: float) -> None Sets the maximum value of the adjustment. Note that values will be restricted by `upper - page-size` if the page-size property is nonzero. See :obj:`~gi.repository.Gtk.Adjustment.set_lower` about how to compress multiple emissions of the :obj:`~gi.repository.Gtk.Adjustment.signals.changed` signal when setting multiple adjustment properties. :param upper: the new maximum value .. method:: set_value(value: float) -> None Sets the ``GtkAdjustment`` value. The value is clamped to lie between :obj:`~gi.repository.Gtk.Adjustment.props.lower` and :obj:`~gi.repository.Gtk.Adjustment.props.upper`. Note that for adjustments which are used in a ``GtkScrollbar``, the effective range of allowed values goes from :obj:`~gi.repository.Gtk.Adjustment.props.lower` to :obj:`~gi.repository.Gtk.Adjustment.props.upper` - :obj:`~gi.repository.Gtk.Adjustment.props.page_size`. :param value: the new value Properties ---------- .. rst-class:: interim-class .. class:: Adjustment :no-index: .. attribute:: props.lower :type: float The minimum value of the adjustment. .. attribute:: props.page_increment :type: float The page increment of the adjustment. .. attribute:: props.page_size :type: float The page size of the adjustment. Note that the page-size is irrelevant and should be set to zero if the adjustment is used for a simple scalar value, e.g. in a ``GtkSpinButton``. .. attribute:: props.step_increment :type: float The step increment of the adjustment. .. attribute:: props.upper :type: float The maximum value of the adjustment. Note that values will be restricted by `upper - page-size` if the page-size property is nonzero. .. attribute:: props.value :type: float The value of the adjustment. Signals ------- .. rst-class:: interim-class .. class:: Adjustment.signals :no-index: .. method:: changed() -> None Emitted when one or more of the ``GtkAdjustment`` properties have been changed. Note that the :obj:`~gi.repository.Gtk.Adjustment.props.value` property is covered by the :obj:`~gi.repository.Gtk.Adjustment.signals.value_changed` signal. .. method:: value_changed() -> None Emitted when the value has been changed. Virtual Methods --------------- .. rst-class:: interim-class .. class:: Adjustment :no-index: .. method:: do_changed() -> None .. method:: do_value_changed() -> None Fields ------ .. rst-class:: interim-class .. class:: Adjustment :no-index: .. attribute:: parent_instance