Gtk.FontButton

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 Gtk.FontChooser Gtk.FontChooser GObject.GInterface->Gtk.FontChooser 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.FontButton Gtk.FontButton Gtk.FontChooser->Gtk.FontButton Gtk.Widget->Gtk.FontButton

Example

../_images/FontButton.png
Subclasses:

None

Methods

Inherited:

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

Structs:

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

class

new ()

class

new_with_font (fontname)

get_modal ()

get_title ()

get_use_font ()

get_use_size ()

set_modal (modal)

set_title (title)

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), Gtk.FontChooser (7)

Properties

Inherited:

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

Name

Type

Flags

Short Description

modal

bool

r/w/en

title

str

r/w

use-font

bool

r/w/en

use-size

bool

r/w/en

Signals

Inherited:

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

Name

Short Description

activate

Emitted to when the font button is activated.

font-set

Emitted when the user selects a font.

Fields

Inherited:

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

Class Details

class Gtk.FontButton(**kwargs)
Bases:

Gtk.Widget, Gtk.FontChooser

Abstract:

No

The GtkFontButton allows to open a font chooser dialog to change the font.

An example Gtk.FontButton

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

CSS nodes

`` fontbutton ╰── button.font

╰── [content]

``

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

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

classmethod new()[source]
Returns:

a new font picker widget.

Return type:

Gtk.Widget

Creates a new font picker widget.

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

classmethod new_with_font(fontname)[source]
Parameters:

fontname (str) – Name of font to display in font chooser dialog

Returns:

a new font picker widget.

Return type:

Gtk.Widget

Creates a new font picker widget showing the given font.

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

get_modal()[source]
Returns:

True if the dialog is modal

Return type:

bool

Gets whether the dialog is modal.

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

get_title()[source]
Returns:

an internal copy of the title string which must not be freed.

Return type:

str

Retrieves the title of the font chooser dialog.

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

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.

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

get_use_size()[source]
Returns:

whether the selected size is used in the label.

Return type:

bool

Returns whether the selected size is used in the label.

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

set_modal(modal)[source]
Parameters:

modal (bool) – True to make the dialog modal

Sets whether the dialog should be modal.

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

set_title(title)[source]
Parameters:

title (str) – a string containing the font chooser dialog title

Sets the title for the font chooser dialog.

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

set_use_font(use_font)[source]
Parameters:

use_font (bool) – If True, font name will be written using font chosen.

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

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

set_use_size(use_size)[source]
Parameters:

use_size (bool) – If True, font name will be written using the selected size.

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

Deprecated since version 4.10: Use [class`Gtk`.FontDialogButton] instead

Signal Details

Gtk.FontButton.signals.activate(font_button)
Signal Name:

activate

Flags:

RUN_FIRST, ACTION

Parameters:

font_button (Gtk.FontButton) – The object which received the signal

Emitted to when the font button is activated.

The ::activate signal on GtkFontButton is an action signal and emitting it causes the button to present its dialog.

New in version 4.4.

Gtk.FontButton.signals.font_set(font_button)
Signal Name:

font-set

Flags:

RUN_FIRST

Parameters:

font_button (Gtk.FontButton) – The object which received the signal

Emitted when the user selects a font.

When handling this signal, use [method`Gtk`.FontChooser.get_font] to find out which font was just selected.

Note that this signal is only emitted when the user changes the font. If you need to react to programmatic font changes as well, use the notify::font signal.

Property Details

Gtk.FontButton.props.modal
Name:

modal

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the font chooser dialog should be modal.

Gtk.FontButton.props.title
Name:

title

Type:

str

Default Value:

'Pick a Font'

Flags:

READABLE, WRITABLE

The title of the font chooser dialog.

Gtk.FontButton.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.FontButton.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.