Gtk.LinkButton¶
Example¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Button (29), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Actionable (5), Gtk.Activatable (6)
- Structs:
Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class |
|
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Button (6), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Actionable (4), Gtk.Activatable (2)
Properties¶
- Inherited:
Gtk.Button (9), Gtk.Container (3), Gtk.Widget (39), Gtk.Actionable (2), Gtk.Activatable (2)
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
The URI bound to this button |
||
r/w/en |
Whether this link has been visited. |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name |
Short Description |
---|---|
The |
Fields¶
- Inherited:
Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gtk.LinkButton(*args, **kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A
Gtk.LinkButton
is aGtk.Button
with a hyperlink, similar to the one used by web browsers, which triggers an action when clicked. It is useful to show quick links to resources.A link button is created by calling either
Gtk.LinkButton.new
() orGtk.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
Gtk.LinkButton
can be set specifically usingGtk.LinkButton.set_uri
(), and retrieved usingGtk.LinkButton.get_uri
().By default,
Gtk.LinkButton
callsGtk.show_uri_on_window
() when the button is clicked. This behaviour can be overridden by connecting to theGtk.LinkButton
::activate-link
signal and returningTrue
from the signal handler.- CSS nodes
Gtk.LinkButton
has a single CSS node with name button. To differentiate it from a plainGtk.Button
, it gets the .link style class.- classmethod new(uri)[source]¶
- Parameters:
uri (
str
) – a valid URI- Returns:
a new link button widget.
- Return type:
Creates a new
Gtk.LinkButton
with the URI as its text.New in version 2.10.
- classmethod new_with_label(uri, label)[source]¶
- Parameters:
- Returns:
a new link button widget.
- Return type:
Creates a new
Gtk.LinkButton
containing a label.New in version 2.10.
- 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 set using
Gtk.LinkButton.set_uri
().New in version 2.10.
- get_visited()[source]¶
-
Retrieves the “visited” state of the URI where the
Gtk.LinkButton
points. 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
Gtk.LinkButton.set_visited
().New in version 2.14.
- set_uri(uri)[source]¶
- Parameters:
uri (
str
) – a valid URI
Sets uri as the URI where the
Gtk.LinkButton
points. As a side-effect this unsets the “visited” state of the button.New in version 2.10.
- set_visited(visited)[source]¶
- Parameters:
visited (
bool
) – the new “visited” state
Sets the “visited” state of the URI where the
Gtk.LinkButton
points. SeeGtk.LinkButton.get_visited
() for more details.New in version 2.14.
- do_activate_link() virtual¶
- Return type:
class handler for the
Gtk.LinkButton
::activate-link
signal
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- Return type:
The
::activate-link
signal is emitted each time theGtk.LinkButton
has been clicked.The default handler will call
Gtk.show_uri_on_window
() with the URI stored inside theGtk.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.
New in version 2.10.