TextStyle#

class TextStyle[source]#

Class TextStyle to define a font with its size, color and other attributes.

__init__(name: str, font_family: str = '', font_size: float = 0.0, bold=None, italic=None, underline=None, text_color: str = '', background_color: str = '', base_style='NORMAL')[source]#

Set the attributes for a text style. Default is Helvetica with size 9 points, black text on white background If a base_style is passed its attributes are used and modified by the other passed attributes

Parameters:
  • name – name for access in text_styles

  • font_family – font family

  • font_size – size of the font in points

  • bold – bold flag

  • italic – italic flag

  • underline – underline flag

  • text_color – text color

  • background_color – background color

  • base_style – base style

property name: str#

The name of the text style

Getter:

Returns the name of the text style

property font_family: str#

Font family of the text style

Getter:

Returns the font family

Setter:

Sets the font family

property font_size: float#

Size of the text style in points

Getter:

Returns the size

Setter:

Sets the size

property bold: bool#

Bold flag for the text style

Getter:

Returns the bold flag

Setter:

Sets the bold flag

property italic: bool#

Italic flag for the text style

Getter:

Returns the italic flag

Setter:

Sets the italic flag

property underline: bool#

Underline flag for the text style

Getter:

Returns the underline flag

Setter:

Sets the underline flag

property text_color: str#

Text color of the text style

Getter:

Returns the text color

Setter:

Sets the text color

property background_color: str#

Background color of the text style

Getter:

Returns the background color

Setter:

Sets the background color