FontButton

Deprecated since version 4.10: Use FontDialogButton instead

class FontButton(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget, FontChooser

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

https://docs.gtk.org/gtk4/font-button.png

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.

Constructors

class FontButton
classmethod new() Widget

Creates a new font picker widget.

Deprecated since version 4.10: Use FontDialogButton instead

classmethod new_with_font(fontname: str) Widget

Creates a new font picker widget showing the given font.

Deprecated since version 4.10: Use FontDialogButton instead

Parameters:

fontname – Name of font to display in font chooser dialog

Methods

class FontButton
get_modal() bool

Gets whether the dialog is modal.

Deprecated since version 4.10: Use FontDialogButton instead

get_title() str

Retrieves the title of the font chooser dialog.

Deprecated since version 4.10: Use FontDialogButton instead

get_use_font() bool

Returns whether the selected font is used in the label.

Deprecated since version 4.10: Use FontDialogButton instead

get_use_size() bool

Returns whether the selected size is used in the label.

Deprecated since version 4.10: Use FontDialogButton instead

set_modal(modal: bool) None

Sets whether the dialog should be modal.

Deprecated since version 4.10: Use FontDialogButton instead

Parameters:

modalTrue to make the dialog modal

set_title(title: str) None

Sets the title for the font chooser dialog.

Deprecated since version 4.10: Use FontDialogButton instead

Parameters:

title – a string containing the font chooser dialog title

set_use_font(use_font: bool) None

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

Deprecated since version 4.10: Use FontDialogButton instead

Parameters:

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

set_use_size(use_size: bool) None

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

Deprecated since version 4.10: Use FontDialogButton instead

Parameters:

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

Properties

class FontButton
props.modal: bool

Whether the font chooser dialog should be modal.

props.title: str

The title of the font chooser dialog.

props.use_font: bool

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

props.use_size: bool

Whether the buttons label will use the selected font size.

Signals

class FontButton.signals
activate() None

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.

Added in version 4.4.

font_set() None

Emitted when the user selects a font.

When handling this signal, use 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.