Font
Represent a text font with a name, style, and size.
Use a Font to change how text looks on a Label, TextField, or TextArea.
Creating a Font
You can create a Font using the following functions:
Font(name)
Font(name, style, size)
| Parameter | Type | Default | Description |
|---|---|---|---|
name |
str |
required | The font name, for example "Serif", "Dialog", or "TimesRoman". |
style |
tuple |
PLAIN |
The text style, one of Font.PLAIN, Font.BOLD, Font.ITALIC, or Font.BOLDITALIC. |
size |
int |
-1 |
The point size. If left as the default, the standard size is used. |
For example,
font = Font("Arial", Font.ITALIC, 16)
Once created, you can use it with the setFont() function from a Label, TextField, or TextArea object.
Functions
Once a Font font has been created, the following functions are available:
| Function | Description |
|---|---|
font.getName() |
Return the font's name. |
font.getStyle() |
Return the font's style. |
font.getSize() |
Return the font's point size. |
font.setName(name) |
Set the font's name. |
font.setStyle(style) |
Set the font's style. |
font.setSize(size) |
Set the font's point size. |