Font

class widgets.Font(name: str, size: float)

A Font object represents a font (with name and size) to be used on labels, buttons, text views etc.

SIZE

The default font size.

SIZE_LABEL

Returns the standard font size used for labels.

SIZE_BUTTON

Returns the standard font size used for buttons.

SIZE_SMALL_SYSTEM

Returns the size of the standard small system font.

SIZE_SYSTEM

Returns the size of the standard system font.

classmethod bold_system_font_of_size(size: float)

Returns the font object used for standard interface items that are rendered in boldface type in the specified size

Parameters:

size – The size (in points) for the font. This value must be greater than 0.0.

Return type:

Font

classmethod font_names_for_family_name(name: str) → List[str]

Returns an array of font names available in a particular font family.

Parameters:

name – The name of the font family. Use the font_family_names() function to get an array of the available font family names on the system.

Return type:

List[str]

classmethod font_with_style(style: 'widgets.TextStyle') → 'widgets.Font'

Returns an instance of the system font for the specified text style and scaled appropriately for the user’s selected content size category.

Parameters:

style – The text style for which to return a font. See TextStyle for possible values.

Return type:

Font

classmethod italic_system_font_of_size(size: float) → 'widgets.Font'

Returns the font object used for standard interface items that are rendered in italic type in the specified size.

Parameters:

size – The size (in points) for the font. This value must be greater than 0.0.

Return type:

Font

classmethod system_font_of_size(size: float) → 'widgets.Font'

Returns the font object used for standard interface items in the specified size.

Parameters:

size – The size (in points) to which the font is scaled. This value must be greater than 0.0.

Return type:

Font

with_size(size: float) → 'widgets.Font'

Returns a font object that is the same as the receiver but which has the specified size instead.

Parameters:

size – The desired size (in points) of the new font object. This value must be greater than 0.0.

Return type:

Font