:right-sidebar: True LinkButton =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: LinkButton(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Button`, :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Actionable`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` :Constructors: :: LinkButton(**properties) new(uri:str) -> Gtk.Widget new_with_label(uri:str, label:str=None) -> Gtk.Widget Constructors ------------ .. rst-class:: interim-class .. class:: LinkButton :no-index: .. classmethod:: new(uri: str) -> ~gi.repository.Gtk.Widget Creates a new ``GtkLinkButton`` with the URI as its text. :param uri: a valid URI .. classmethod:: new_with_label(uri: str, label: str | None = None) -> ~gi.repository.Gtk.Widget Creates a new ``GtkLinkButton`` containing a label. :param uri: a valid URI :param label: the text of the button Methods ------- .. rst-class:: interim-class .. class:: LinkButton :no-index: .. method:: get_uri() -> str Retrieves the URI of the ``GtkLinkButton``. .. method:: 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 :obj:`~gi.repository.Gtk.LinkButton.set_visited`. .. method:: set_uri(uri: str) -> None Sets ``uri`` as the URI where the ``GtkLinkButton`` points. As a side-effect this unsets the “visited” state of the button. :param uri: a valid URI .. method:: set_visited(visited: bool) -> None Sets the “visited” state of the ``GtkLinkButton``. See :obj:`~gi.repository.Gtk.LinkButton.get_visited` for more details. :param visited: the new “visited” state Properties ---------- .. rst-class:: interim-class .. class:: LinkButton :no-index: .. attribute:: props.uri :type: str The URI bound to this button. .. attribute:: props.visited :type: bool The 'visited' state of this button. A visited link is drawn in a different color. Signals ------- .. rst-class:: interim-class .. class:: LinkButton.signals :no-index: .. method:: activate_link() -> bool Emitted each time the ``GtkLinkButton`` is clicked. The default handler will call :obj:`~gi.repository.Gtk.FileLauncher.launch` with the URI stored inside the :obj:`~gi.repository.Gtk.LinkButton.props.uri` property. To override the default behavior, you can connect to the ::activate-link signal and stop the propagation of the signal by returning :const:`True` from your handler.