Gtk.FontButton¶
class — extends Widget, Accessible, Buildable, ConstraintTarget, FontChooser
:::warning Deprecated since 4.10 This API is deprecated. :::
The GtkFontButton allows to open a font chooser dialog to change
the font.
<picture> <source srcset="font-button-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkFontButton" src="font-button.png"> </picture>
It is suitable widget for selecting a font in a preference dialog.
CSS nodes¶
GtkFontButton has a single CSS node with name fontbutton which
contains a button node with the .font style class.
Constructors¶
new¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Creates a new font picker widget.
new_with_font¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Creates a new font picker widget showing the given font.
Parameters:
fontname— Name of font to display in font chooser dialog
Methods¶
get_modal¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets whether the dialog is modal.
get_title¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Retrieves the title of the font chooser dialog.
get_use_font¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns whether the selected font is used in the label.
get_use_size¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns whether the selected size is used in the label.
set_modal¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets whether the dialog should be modal.
Parameters:
modal—Trueto make the dialog modal
set_title¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the title for the font chooser dialog.
Parameters:
title— a string containing the font chooser dialog title
set_use_font¶
:::warning Deprecated since 4.10 This API is deprecated. :::
If use_font is True, the font name will be written
using the selected font.
Parameters:
use_font— IfTrue, font name will be written using font chosen.
set_use_size¶
:::warning Deprecated since 4.10 This API is deprecated. :::
If use_size is True, the font name will be written using
the selected size.
Parameters:
use_size— IfTrue, font name will be written using the selected size.
Properties¶
modal¶
Whether the font chooser dialog should be modal.
title¶
The title of the font chooser dialog.
use_font¶
Whether the buttons label will be drawn in the selected font.
use_size¶
Whether the buttons label will use the selected font size.
Signals¶
activate¶
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.
font-set¶
Emitted when the user selects a font.
When handling this signal, use 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.