:right-sidebar: True ShortcutLabel =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: ShortcutLabel(**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` ``GtkShortcutLabel`` displays a single keyboard shortcut or gesture. The main use case for ``GtkShortcutLabel`` is inside a :obj:`~gi.repository.Gtk.ShortcutsWindow`. Constructors ------------ .. rst-class:: interim-class .. class:: ShortcutLabel :no-index: .. classmethod:: new(accelerator: str) -> ~gi.repository.Gtk.Widget Creates a new ``GtkShortcutLabel`` with ``accelerator`` set. :param accelerator: the initial accelerator Methods ------- .. rst-class:: interim-class .. class:: ShortcutLabel :no-index: .. method:: get_accelerator() -> str | None Retrieves the current accelerator of ``self``. .. method:: get_disabled_text() -> str | None Retrieves the text that is displayed when no accelerator is set. .. method:: set_accelerator(accelerator: str) -> None Sets the accelerator to be displayed by ``self``. :param accelerator: the new accelerator .. method:: set_disabled_text(disabled_text: str) -> None Sets the text to be displayed by ``self`` when no accelerator is set. :param disabled_text: the text to be displayed when no accelerator is set Properties ---------- .. rst-class:: interim-class .. class:: ShortcutLabel :no-index: .. attribute:: props.accelerator :type: str The accelerator that ``self`` displays. See :obj:`~gi.repository.Gtk.ShortcutsShortcut.props.accelerator` for the accepted syntax. .. attribute:: props.disabled_text :type: str The text that is displayed when no accelerator is set.