Gtk.LinkButton¶
Example¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Button (16), Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Actionable (5)
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Gtk.Button (6), Gtk.Widget (34), Gtk.Accessible (1), Gtk.Actionable (2)
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted each time the |
Fields¶
- Inherited:
Class Details¶
- class Gtk.LinkButton(**kwargs)¶
- Bases:
- Abstract:
No
A
GtkLinkButton
is a button with a hyperlink.An example
Gtk.LinkButton
It is useful to show quick links to resources.
A link button is created by calling either [ctor`Gtk`.LinkButton.new] or [ctor`Gtk`.LinkButton.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 [method`Gtk`.LinkButton.set_uri].By default,
GtkLinkButton
calls [method`Gtk`.FileLauncher.launch] when the button is clicked. This behaviour can be overridden by connecting to the [signal`Gtk`.LinkButton::activate-link] signal and returningTrue
from the signal handler.- CSS nodes
GtkLinkButton
has a single CSS node with name button. To differentiate it from a plainGtkButton
, it gets the .link style class.- Accessibility
GtkLinkButton
uses theGtk.AccessibleRole.LINK
role.- classmethod new(uri)[source]¶
- Parameters:
uri (
str
) – a valid URI- Returns:
a new link button widget.
- Return type:
Creates a new
GtkLinkButton
with the URI as its text.
- classmethod new_with_label(uri, label)[source]¶
- Parameters:
- Returns:
a new link button widget.
- Return type:
Creates a new
GtkLinkButton
containing a label.
- get_uri()[source]¶
- Returns:
a valid URI. The returned string is owned by the link button and should not be modified or freed.
- Return type:
Retrieves the URI of the
GtkLinkButton
.
- get_visited()[source]¶
-
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 [method`Gtk`.LinkButton.set_visited].
Signal Details¶
- Gtk.LinkButton.signals.activate_link(link_button)¶
- Signal Name:
activate-link
- Flags:
- Parameters:
link_button (
Gtk.LinkButton
) – The object which received the signal- Returns:
True
if the signal has been handled- Return type:
Emitted each time the
GtkLinkButton
is clicked.The default handler will call [method`Gtk`.FileLauncher.launch] with the URI stored inside the [property`Gtk`.LinkButton:uri] property.
To override the default behavior, you can connect to the
::activate-link
signal and stop the propagation of the signal by returningTrue
from your handler.
Property Details¶
- Gtk.LinkButton.props.uri¶
-
The URI bound to this button.