Gtk.Shortcut¶
class — extends GObject.Object
Describes a keyboard shortcut.
It contains a description of how to trigger the shortcut via a
ShortcutTrigger and a way to activate the shortcut
on a widget via a ShortcutAction.
The actual work is usually done via ShortcutController,
which decides if and when to activate a shortcut. Using that controller
directly however is rarely necessary as various higher level
convenience APIs exist on GtkWidgets that make it easier to use
shortcuts in GTK.
GtkShortcut does provide functionality to make it easy for users
to work with shortcuts, either by providing informational strings
for display purposes or by allowing shortcuts to be configured.
Constructors¶
new¶
@classmethod
def new(cls, trigger: ShortcutTrigger | None = ..., action: ShortcutAction | None = ...) -> Shortcut
Creates a new GtkShortcut that is triggered by
trigger and then activates action.
Parameters:
trigger— The trigger that will trigger the shortcutaction— The action that will be activated upon triggering
Methods¶
get_action¶
Gets the action that is activated by this shortcut.
get_arguments¶
Gets the arguments that are passed when activating the shortcut.
get_trigger¶
Gets the trigger used to trigger self.
set_action¶
Sets the new action for self to be action.
Parameters:
action— The new action. If theactionisNone, the nothing action will be used.
set_arguments¶
Sets the arguments to pass when activating the shortcut.
Parameters:
args— arguments to pass when activatingself
set_trigger¶
Sets the new trigger for self to be trigger.
Parameters:
trigger— The new trigger. If thetriggerisNone, the never trigger will be used.
Properties¶
action¶
The action that gets activated by this shortcut.
arguments¶
Arguments passed to activation.
trigger¶
The trigger that triggers this shortcut.