LinkButton#
Superclasses: Button
, Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Actionable
, Buildable
, ConstraintTarget
A GtkLinkButton
is a button with a hyperlink.
It is useful to show quick links to resources.
A link button is created by calling either new
or
new_with_label
. If using the former, the URI you
pass to the constructor is used as a label for the widget.
The URI bound to a GtkLinkButton
can be set specifically using
set_uri
.
By default, GtkLinkButton
calls launch
when the button
is clicked. This behaviour can be overridden by connecting to the
activate_link
signal and returning True
from
the signal handler.
Shortcuts and Gestures#
GtkLinkButton
supports the following keyboard shortcuts:
Shift`+:kbd:`F10 or Menu opens the context menu.
Actions#
GtkLinkButton
defines a set of built-in actions:
clipboard.copy
copies the url to the clipboard.menu.popup
opens the context menu.
CSS nodes#
GtkLinkButton
has a single CSS node with name button. To differentiate
it from a plain GtkButton
, it gets the .link style class.
Accessibility#
GtkLinkButton
uses the LINK
role.
Constructors#
Methods#
- class LinkButton
-
- get_visited() → bool#
Retrieves the “visited” state of the
GtkLinkButton
.The button becomes visited when it is clicked. If the URI is changed on the button, the “visited” state is unset again.
The state may also be changed using
set_visited
.
- set_uri(uri: str) → None#
Sets
uri
as the URI where theGtkLinkButton
points.As a side-effect this unsets the “visited” state of the button.
- Parameters:
uri – a valid URI
- set_visited(visited: bool) → None#
Sets the “visited” state of the
GtkLinkButton
.See
get_visited
for more details.- Parameters:
visited – the new “visited” state