Gtk.AboutDialog


Gtk.AboutDialog — Display information about an application

Object Hierarchy:

    GObject
    ╰── GInitiallyUnowned
        ╰── Gtk.Widget
            ╰── Gtk.Container
                ╰── Gtk.Bin
                    ╰── Gtk.Window
                        ╰── Gtk.Dialog
                            ╰── Gtk.AboutDialog

Functions:


Signals:

  • “activate-link” (label, uri, user_data)

Description:

The Gtk.AboutDialog offers a simple way to display information about a program like its logo, name, copyright, website and license. It is also possible to give credits to the authors, documenters, translators and artists who have worked on the program. An about dialog is typically opened when the user selects the About option from the Help menu.

All parts of the dialog are optional.

About dialogs often contain links and email addresses. Gtk.AboutDialog displays these as clickable links. By default, it calls Gtk.show_uri() when a user clicks one. The behaviour can be overridden with the Gtk.AboutDialog::activate-link signal.

To specify a person with an email address, use a string like Edgar Allan Poe <edgarpoe.com >. To specify a website with a title, use a string like GTK+ team http://www.gtk.org.

To make constructing a Gtk.AboutDialog as convenient as possible, you can use the function Gtk.show_about_dialog() which constructs and shows a dialog and keeps it around so that it can be shown again.

Note that GTK+ sets a default title of _("About %s") on the dialog window (where \%s is replaced by the name of the application, but in order to ensure proper translation of the title, applications should set the title property explicitly when constructing a Gtk.AboutDialog, as shown in the following example:

    def on_button_clicked(self, button):
        dialog = Gtk.AboutDialog()
        dialog.set_title("AboutDialog")
        dialog.set_name("Python Gtk+3")
        dialog.set_version("1.0")
        dialog.set_comments("Python Gtk+3 Object and Widget API")
        dialog.set_website("https://athenajc.gitbooks.io/python-gtk-3-api/content/")
        dialog.set_website_label("PyGtk3 API")
        dialog.set_authors(["Athena Chuang"])
        dialog.set_logo(GdkPixbuf.Pixbuf.new_from_file_at_size("../_resources/gtk.png", 64, 64))
        dialog.connect('response', lambda dialog, data: dialog.destroy())
        dialog.show_all()

It is also possible to show a Gtk.AboutDialog like any other Gtk.Dialog, e.g. using Gtk.Dialog::run(). In this case, you might need to know that the “Close” button returns the Gtk.ResponseType.CANCEL response id.


Function Details:

new()

new () -> Gtk.Widget

Creates a new Gtk.AboutDialog.

  • Returns: a newly created Gtk.AboutDialog

  • Since: 2.6


get_program_name()

get_program_name (self) -> str

Returns the program name displayed in the about dialog.

  • Returns: The program name. The string is owned by the aboutdialog and must not be modified.

  • Since: 2.12


set_program_name()

set_program_name (self, name:str)

Sets the name to display in the about dialog.If this is not set, it defaults to g_get_application_name().

  • Since: 2.12

get_version()

get_version (self) -> str

Returns the version string.

  • Returns: The version string. The string is owned by the aboutdialog and must not be modified.

  • Since: 2.6


set_version()

set_version (self, version:str=None)

Sets the version string to display in the about dialog.

  • Since: 2.6

get_copyright()

get_copyright (self) -> str

Returns the copyright string.

  • Returns: The copyright string. The string is owned by the aboutdialog and must not be modified.

  • Since: 2.6


set_copyright()

set_copyright (self, copyright:str=None)

Sets the copyright string to display in the about dialog.This should be a short string of one or two lines.

  • Since: 2.6

get_comments()

get_comments (self) -> str

Returns the comments string.

  • Returns: The comments. The string is owned by the aboutdialog and must not be modified.

  • Since: 2.6


set_comments()

set_comments (self, comments:str=None)

Sets the comments string to display in the about dialog.This should be a short string of one or two lines.

  • Since: 2.6

get_license()

get_license (self) -> str

Returns the license information.

  • Returns: The license information. The string is owned by the aboutdialog and must not be modified.

  • Since: 2.6


set_license()

set_license (self, license:str=None)

Sets the license information to be displayed in the secondarylicense dialog. If license is None, the license button ishidden.

  • Since: 2.6

get_wrap_license()

get_wrap_license (self) -> bool

Returns whether the license text in about isautomatically wrapped.

  • Returns: True if the license text is wrapped

  • Since: 2.8


set_wrap_license()

set_wrap_license (self, wrap_license:bool)

Sets whether the license text in about isautomatically wrapped.

  • Since: 2.8

get_license_type()

get_license_type (self) -> Gtk.License

Retrieves the license set using Gtk.AboutDialog:set_license_type()

  • Returns: a Gtk.License value

  • Since: 3.0


set_license_type()

set_license_type (self, license_type:Gtk.License)

Sets the license of the application showing the about dialog from alist of known licenses. This function overrides the license set usingGtk.AboutDialog:set_license().

  • Since: 3.0

get_website()

get_website (self) -> str

Returns the website URL.

  • Returns: The website URL. The string is owned by the aboutdialog and must not be modified.

  • Since: 2.6


set_website()

set_website (self, website:str=None)

Sets the URL to use for the website link.

  • Since: 2.6

get_website_label()

get_website_label (self) -> str

Returns the label used for the website link.

  • Returns: The label used for the website link. The string isowned by the about dialog and must not be modified.

  • Since: 2.6


set_website_label()

set_website_label (self, website_label:str)

Sets the label to be used for the website link.

  • Since: 2.6

get_authors()

get_authors (self) -> list

Returns the string which are displayed in the authors tabof the secondary credits dialog.

  • Returns: ANone-terminated string array containing the authors. The array isowned by the about dialog and must not be modified.

  • Since: 2.6


set_authors()

set_authors (self, authors:list)

Sets the strings which are displayed in the authors tabof the secondary credits dialog.

  • Since: 2.6

get_artists()

get_artists (self) -> list

Returns the string which are displayed in the artists tabof the secondary credits dialog.

  • Returns: ANone-terminated string array containing the artists. The array isowned by the about dialog and must not be modified.

  • Since: 2.6


set_artists()

set_artists (self, artists:list)

Sets the strings which are displayed in the artists tabof the secondary credits dialog.

  • Since: 2.6

get_documenters()

get_documenters (self) -> list

Returns the string which are displayed in the documenterstab of the secondary credits dialog.

  • Returns: ANone-terminated string array containing the documenters. Thearray is owned by the about dialog and must not be modified.

  • Since: 2.6


set_documenters()

set_documenters (self, documenters:list)

Sets the strings which are displayed in the documenters tabof the secondary credits dialog.

  • Since: 2.6

get_translator_credits()

get_translator_credits (self) -> str

Returns the translator credits string which is displayedin the translators tab of the secondary credits dialog.

  • Returns: The translator credits string. The string isowned by the about dialog and must not be modified.

  • Since: 2.6


set_translator_credits()

set_translator_credits (self, translator_credits:str=None)

Sets the translator credits string which is displayed inthe translators tab of the secondary credits dialog. The intended use for this string is to display the translatorof the language which is currently used in the user interface.Using gettext(), a simple way to achieve that is to mark thestring for translation: Gtk.AboutDialog:settranslator_credits (about, ("translator-credits")); It is a good idea to use the customary msgid “translator-credits” for thispurpose, since translators will already know the purpose of that msgid, andsince Gtk.AboutDialog will detect if “translator-credits” is untranslatedand hide the tab.

  • Since: 2.6

get_logo (self) -> GdkPixbuf.Pixbuf

Returns the pixbuf displayed as logo in the about dialog.

  • Returns: the pixbuf displayed as logo. Thepixbuf is owned by the about dialog. If you want to keep areference to it, you have to call g_object_ref() on it.

  • Since: 2.6


set_logo (self, logo:GdkPixbuf.Pixbuf=None)

Sets the pixbuf to be displayed as logo in the about dialog.If it is None, the default window icon set with`Gtk.Window:set_default_icon()` will be used.

  • Since: 2.6

get_logo_icon_name()

get_logo_icon_name (self) -> str

Returns the icon name displayed as logo in the about dialog.

  • Returns: the icon name displayed as logo. The string isowned by the dialog. If you want to keep a referenceto it, you have to call g_strdup() on it.

  • Since: 2.6


set_logo_icon_name()

set_logo_icon_name (self, icon_name:str=None)

Sets the pixbuf to be displayed as logo in the about dialog.If it is None, the default window icon set with`Gtk.Window:set_default_icon()` will be used.

  • Since: 2.6

add_credit_section()

add_credit_section (self, section_name:str, people:list)

Creates a new section in the Credits page.

  • Since: 3.4

Example:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GdkPixbuf

class AboutDialog(Gtk.AboutDialog):
    def __init__(self):
        logo = GdkPixbuf.Pixbuf.new_from_file_at_size("../_resources/gtk.png", 64, 64)

        Gtk.AboutDialog.__init__(self)
        self.set_title("AboutDialog")
        self.set_name("Programmica")
        self.set_version("1.0")
        self.set_comments("Programming, system and network administration resources")
        self.set_website("https://programmica.com/")
        self.set_website_label("Programmica Website")
        self.set_authors(["Andrew Steele"])
        self.set_logo(logo)
        self.connect("response", self.on_response)

    def on_response(self, dialog, response):
        self.destroy()

aboutdialog = AboutDialog()
aboutdialog.run()

results matching ""

    No results matching ""