:right-sidebar: True ShortcutAction =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: ShortcutAction(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.Gtk.ActivateAction`, :class:`~gi.repository.Gtk.CallbackAction`, :class:`~gi.repository.Gtk.MnemonicAction`, :class:`~gi.repository.Gtk.NamedAction`, :class:`~gi.repository.Gtk.NothingAction`, :class:`~gi.repository.Gtk.SignalAction` :Constructors: :: ShortcutAction(**properties) parse_string(string:str) -> Gtk.ShortcutAction or None Constructors ------------ .. rst-class:: interim-class .. class:: ShortcutAction :no-index: .. classmethod:: parse_string(string: str) -> ~gi.repository.Gtk.ShortcutAction | None Tries to parse the given string into an action. On success, the parsed action is returned. When parsing failed, :const:`None` is returned. The accepted strings are: - ``nothing``, for ``GtkNothingAction`` - ``activate``, for ``GtkActivateAction`` - ``mnemonic-activate``, for ``GtkMnemonicAction`` - ``action(NAME)``, for a ``GtkNamedAction`` for the action named ``NAME`` - ``signal(NAME)``, for a ``GtkSignalAction`` for the signal ``NAME`` :param string: the string to parse Methods ------- .. rst-class:: interim-class .. class:: ShortcutAction :no-index: .. method:: activate(flags: ~gi.repository.Gtk.ShortcutActionFlags, widget: ~gi.repository.Gtk.Widget, args: ~gi.repository.GLib.Variant | None = None) -> bool Activates the action on the ``widget`` with the given ``args``. Note that some actions ignore the passed in ``flags``, ``widget`` or ``args``. Activation of an action can fail for various reasons. If the action is not supported by the ``widget``, if the ``args`` don't match the action or if the activation otherwise had no effect, :const:`False` will be returned. :param flags: flags to activate with :param widget: Target of the activation :param args: arguments to pass .. method:: print_(string: ~gi.repository.GLib.String) -> None :param string: .. method:: to_string() -> str Prints the given action into a human-readable string. This is a small wrapper around :obj:`~gi.repository.Gtk.ShortcutAction.print` to help when debugging.