Gtk.FontDialogButton

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.FontDialogButton Gtk.FontDialogButton Gtk.Widget->Gtk.FontDialogButton

Example

../_images/FontDialogButton.png
Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (dialog)

get_dialog ()

get_font_desc ()

get_font_features ()

get_language ()

get_level ()

get_use_font ()

get_use_size ()

set_dialog (dialog)

set_font_desc (font_desc)

set_font_features (font_features)

set_language (language)

set_level (level)

set_use_font (use_font)

set_use_size (use_size)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

dialog

Gtk.FontDialog

r/w/en

font-desc

Pango.FontDescription

r/w/en

font-features

str

r/w/en

language

Pango.Language

r/w/en

level

Gtk.FontLevel

r/w/en

use-font

bool

r/w/en

use-size

bool

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

activate

Emitted when the font dialog button is activated.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.FontDialogButton(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Gtk.FontDialogButtonClass

The GtkFontDialogButton is wrapped around a [class`Gtk`.FontDialog] and allows to open a font chooser dialog to change the font.

An example Gtk.FontDialogButton

It is suitable widget for selecting a font in a preference dialog.

CSS nodes

`` fontbutton ╰── button.font

╰── [content]

``

GtkFontDialogButton has a single CSS node with name fontbutton which contains a button node with the .font style class.

New in version 4.10.

classmethod new(dialog)[source]
Parameters:

dialog (Gtk.FontDialog or None) – the GtkFontDialog to use

Returns:

the new GtkFontDialogButton

Return type:

Gtk.Widget

Creates a new GtkFontDialogButton with the given GtkFontDialog.

You can pass NULL to this function and set a GtkFontDialog later. The button will be insensitive until that happens.

New in version 4.10.

get_dialog()[source]
Returns:

the GtkFontDialog

Return type:

Gtk.FontDialog or None

Returns the GtkFontDialog of self.

New in version 4.10.

get_font_desc()[source]
Returns:

the font

Return type:

Pango.FontDescription or None

Returns the font of the button.

This function is what should be used to obtain the font that was chosen by the user. To get informed about changes, listen to “notify::font-desc”.

New in version 4.10.

get_font_features()[source]
Returns:

the font features

Return type:

str or None

Returns the font features of the button.

This function is what should be used to obtain the font features that were chosen by the user. To get informed about changes, listen to “notify::font-features”.

Note that the button will only let users choose font features if [property`Gtk`.FontDialogButton:level] is set to GTK_FONT_LEVEL_FEATURES.

New in version 4.10.

get_language()[source]
Returns:

the language

Return type:

Pango.Language or None

Returns the language that is used for font features.

New in version 4.10.

get_level()[source]
Returns:

the level of detail

Return type:

Gtk.FontLevel

Returns the level of detail at which this dialog lets the user select fonts.

New in version 4.10.

get_use_font()[source]
Returns:

whether the selected font is used in the label

Return type:

bool

Returns whether the selected font is used in the label.

New in version 4.10.

get_use_size()[source]
Returns:

whether the selected font size is used in the label

Return type:

bool

Returns whether the selected font size is used in the label.

New in version 4.10.

set_dialog(dialog)[source]
Parameters:

dialog (Gtk.FontDialog) – the new GtkFontDialog

Sets a GtkFontDialog object to use for creating the font chooser dialog that is presented when the user clicks the button.

New in version 4.10.

set_font_desc(font_desc)[source]
Parameters:

font_desc (Pango.FontDescription) – the new font

Sets the font of the button.

New in version 4.10.

set_font_features(font_features)[source]
Parameters:

font_features (str or None) – the font features

Sets the font features of the button.

New in version 4.10.

set_language(language)[source]
Parameters:

language (Pango.Language or None) – the new language

Sets the language to use for font features.

New in version 4.10.

set_level(level)[source]
Parameters:

level (Gtk.FontLevel) – the level of detail

Sets the level of detail at which this dialog lets the user select fonts.

New in version 4.10.

set_use_font(use_font)[source]
Parameters:

use_font (bool) – If TRUE, font name will be written using the chosen font

If use_font is TRUE, the font name will be written using the selected font.

New in version 4.10.

set_use_size(use_size)[source]
Parameters:

use_size (bool) – If TRUE, font name will be written using the chosen font size

If use_size is TRUE, the font name will be written using the selected font size.

New in version 4.10.

Signal Details

Gtk.FontDialogButton.signals.activate(font_dialog_button)
Signal Name:

activate

Flags:

RUN_FIRST, ACTION

Parameters:

font_dialog_button (Gtk.FontDialogButton) – The object which received the signal

Emitted when the font dialog button is activated.

The ::activate signal on GtkFontDialogButton is an action signal and emitting it causes the button to pop up its dialog.

New in version 4.14.

Property Details

Gtk.FontDialogButton.props.dialog
Name:

dialog

Type:

Gtk.FontDialog

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The GtkFontDialog that contains parameters for the font chooser dialog.

New in version 4.10.

Gtk.FontDialogButton.props.font_desc
Name:

font-desc

Type:

Pango.FontDescription

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The selected font.

This property can be set to give the button its initial font, and it will be updated to reflect the users choice in the font chooser dialog.

Listen to notify::font-desc to get informed about changes to the buttons font.

New in version 4.10.

Gtk.FontDialogButton.props.font_features
Name:

font-features

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The selected font features.

This property will be updated to reflect the users choice in the font chooser dialog.

Listen to notify::font-features to get informed about changes to the buttons font features.

New in version 4.10.

Gtk.FontDialogButton.props.language
Name:

language

Type:

Pango.Language

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The selected language for font features.

This property will be updated to reflect the users choice in the font chooser dialog.

Listen to notify::language to get informed about changes to the buttons language.

New in version 4.10.

Gtk.FontDialogButton.props.level
Name:

level

Type:

Gtk.FontLevel

Default Value:

Gtk.FontLevel.FONT

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The level of detail for the font chooser dialog.

Gtk.FontDialogButton.props.use_font
Name:

use-font

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the buttons label will be drawn in the selected font.

Gtk.FontDialogButton.props.use_size
Name:

use-size

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the buttons label will use the selected font size.