:right-sidebar: True Toggle =================================================================== .. currentmodule:: gi.repository.Adw .. versionadded:: 1.7 .. class:: Toggle(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` A toggle within :obj:`~gi.repository.Adw.ToggleGroup`\. ``AdwToggle`` can optionally have a name, set with :obj:`~gi.repository.Adw.Toggle.props.name`\. If the name is set, :obj:`~gi.repository.Adw.ToggleGroup.props.active_name` can be used to access toggles instead of index. Constructors ------------ .. rst-class:: interim-class .. class:: Toggle :no-index: .. classmethod:: new() -> ~gi.repository.Adw.Toggle Creates a new ``AdwToggle``\. .. versionadded:: 1.7 Methods ------- .. rst-class:: interim-class .. class:: Toggle :no-index: .. method:: get_child() -> ~gi.repository.Gtk.Widget | None Gets the child widget of ``self``\. .. versionadded:: 1.7 .. method:: get_description() -> str Gets the description of ``self``\. .. versionadded:: 1.9 .. method:: get_enabled() -> bool Gets whether ``self`` is enabled. .. versionadded:: 1.7 .. method:: get_icon_name() -> str | None Gets the icon name of ``self``\. .. versionadded:: 1.7 .. method:: get_index() -> int Gets the index of ``self`` within its toggle group. .. versionadded:: 1.7 .. method:: get_label() -> str | None Gets the label of ``self``\. .. versionadded:: 1.7 .. method:: get_name() -> str Gets the name of ``self``\. .. versionadded:: 1.7 .. method:: get_tooltip() -> str Gets the tooltip of ``self``\. .. versionadded:: 1.7 .. method:: get_use_underline() -> bool Gets whether ``self`` uses underlines. .. versionadded:: 1.7 .. method:: set_child(child: ~gi.repository.Gtk.Widget | None = None) -> None Sets the child of ``self`` to ``child``\. When the child is set, icon and label are not displayed. It's recommended to still set the label, as it can still be used by the screen reader. .. versionadded:: 1.7 :param child: a child widget .. method:: set_description(description: str) -> None Sets the description of ``self`` to ``description``\. The description will be read out when using screen reader. If not set, :obj:`~gi.repository.Adw.Toggle.props.tooltip` will be used instead. See :obj:`~gi.repository.Gtk.AccessibleProperty.description`\. .. versionadded:: 1.9 :param description: the description .. method:: set_enabled(enabled: bool) -> None Sets whether ``self`` is enabled. .. versionadded:: 1.7 :param enabled: whether the toggle should be enbled .. method:: set_icon_name(icon_name: str | None = None) -> None Sets the icon name of ``self`` to ``icon_name``\. The icon will be displayed alone or next to the label, unless :obj:`~gi.repository.Adw.Toggle.props.child` is set. .. versionadded:: 1.7 :param icon_name: the icon name .. method:: set_label(label: str | None = None) -> None Sets the label of ``self`` to ``label``\. The label will be displayed alone or next to the icon, unless :obj:`~gi.repository.Adw.Toggle.props.child` is set, but will still be read out by the screen reader. .. versionadded:: 1.7 :param label: a label .. method:: set_name(name: str | None = None) -> None Sets the name of ``self`` to ``name``\. Allows accessing ``self`` by its name instead of index. See :obj:`~gi.repository.Adw.ToggleGroup.props.active_name`\. .. versionadded:: 1.7 :param name: a name .. method:: set_tooltip(tooltip: str) -> None Sets the tooltip of ``self`` to ``tooltip``\. ``tooltip`` can be marked up with the Pango text markup language. Tooltip text will also be used as accessible description. Use :obj:`~gi.repository.Adw.Toggle.props.description` to set it separately. .. versionadded:: 1.7 :param tooltip: the tooltip .. method:: set_use_underline(use_underline: bool) -> None Sets whether an embedded underline in the label indicates a mnemonic. See :obj:`~gi.repository.Adw.Toggle.props.label`\. .. versionadded:: 1.7 :param use_underline: whether an underline in the label indicates a mnemonic Properties ---------- .. rst-class:: interim-class .. class:: Toggle :no-index: .. attribute:: props.child :type: ~gi.repository.Gtk.Widget The type of the None singleton. .. versionadded:: 1.7 .. attribute:: props.description :type: str The type of the None singleton. .. versionadded:: 1.9 .. attribute:: props.enabled :type: bool The type of the None singleton. .. versionadded:: 1.7 .. attribute:: props.icon_name :type: str The type of the None singleton. .. versionadded:: 1.7 .. attribute:: props.label :type: str The type of the None singleton. .. versionadded:: 1.7 .. attribute:: props.name :type: str The type of the None singleton. .. versionadded:: 1.7 .. attribute:: props.tooltip :type: str The type of the None singleton. .. versionadded:: 1.7 .. attribute:: props.use_underline :type: bool The type of the None singleton. .. versionadded:: 1.7