Gtk.FontSelection - Classes - Gtk 3.0 (original) (raw)

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Box Gtk.Box Gtk.FontSelection Gtk.FontSelection Gtk.Box->Gtk.FontSelection Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Box Gtk.Orientable->Gtk.Box Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Box (14), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class new ()
get_face ()
get_face_list ()
get_family ()
get_family_list ()
get_font_name ()
get_preview_entry ()
get_preview_text ()
get_size ()
get_size_entry ()
get_size_list ()
set_font_name (fontname)
set_preview_text (text)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.Box (3), Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)

Name Type Flags Short Description
font-name str r/w The string that represents this font
preview-text str r/w The text to display in order to demonstrate the selected font

Child Properties

Inherited:

Gtk.Box (5)

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name Type Access Description
parent_instance Gtk.Box r

Class Details

class Gtk.FontSelection(*args, **kwargs)

Bases:

Gtk.Box

Abstract:

No

Structure:

Gtk.FontSelectionClass

classmethod new()[source]

Returns:

a new Gtk.FontSelection

Return type:

Gtk.Widget

Creates a new Gtk.FontSelection.

get_face()[source]

Returns:

A Pango.FontFace representing the selected font group details. The returned object is owned byself and must not be modified or freed.

Return type:

Pango.FontFace

Gets the Pango.FontFace representing the selected font group details (i.e. family, slant, weight, width, etc).

New in version 2.14.

get_face_list()[source]

Returns:

A Gtk.Widget that is part of self

Return type:

Gtk.Widget

This returns the Gtk.TreeView which lists all styles available for the selected font. For example, “Regular”, “Bold”, etc.

New in version 2.14.

get_family()[source]

Returns:

A Pango.FontFamily representing the selected font family. Font families are a collection of font faces. The returned object is owned by self and must not be modified or freed.

Return type:

Pango.FontFamily

Gets the Pango.FontFamily representing the selected font family.

New in version 2.14.

get_family_list()[source]

Returns:

A Gtk.Widget that is part of self

Return type:

Gtk.Widget

This returns the Gtk.TreeView that lists font families, for example, “Sans”, “Serif”, etc.

New in version 2.14.

get_font_name()[source]

Returns:

A string with the name of the current font, or None if no font is selected. You must free this string with GLib.free().

Return type:

str

Gets the currently-selected font name.

Note that this can be a different string than what you set withGtk.FontSelection.set_font_name(), as the font selection widget may normalize font names and thus return a string with a different structure. For example, “Helvetica Italic Bold 12” could be normalized to “Helvetica Bold Italic 12”. Use Pango.FontDescription.equal() if you want to compare two font descriptions.

get_preview_entry()[source]

Returns:

A Gtk.Widget that is part of self

Return type:

Gtk.Widget

This returns the Gtk.Entry used to display the font as a preview.

New in version 2.14.

get_preview_text()[source]

Returns:

the text displayed in the preview area. This string is owned by the widget and should not be modified or freed

Return type:

str

Gets the text displayed in the preview area.

get_size()[source]

Returns:

A n integer representing the selected font size, or -1 if no font size is selected.

Return type:

int

The selected font size.

New in version 2.14.

get_size_entry()[source]

Returns:

A Gtk.Widget that is part of self

Return type:

Gtk.Widget

This returns the Gtk.Entry used to allow the user to edit the font number manually instead of selecting it from the list of font sizes.

New in version 2.14.

get_size_list()[source]

Returns:

A Gtk.Widget that is part of self

Return type:

Gtk.Widget

This returns the Gtk.TreeView used to list font sizes.

New in version 2.14.

set_font_name(fontname)[source]

Parameters:

fontname (str) – a font name like “Helvetica 12” or “Times Bold 18”

Returns:

True if the font could be set successfully; False if no such font exists or if the self doesn’t belong to a particular screen yet.

Return type:

bool

Sets the currently-selected font.

Note that the self needs to know the screen in which it will appear for this to work; this can be guaranteed by simply making sure that theself is inserted in a toplevel window before you call this function.

set_preview_text(text)[source]

Parameters:

text (str) – the text to display in the preview area

Sets the text displayed in the preview area. The text is used to show how the selected font looks.

Property Details

Gtk.FontSelection.props.font_name

Name:

font-name

Type:

str

Default Value:

'Sans 10'

Flags:

READABLE, WRITABLE

The string that represents this font

Gtk.FontSelection.props.preview_text

Name:

preview-text

Type:

str

Default Value:

'abcdefghijk ABCDEFGHIJK'

Flags:

READABLE, WRITABLE

The text to display in order to demonstrate the selected font