CTkFont class provides a font object with pixel-based sizing that remains independent of UI scaling. It extends tkinter’s Font class with additional CustomTkinter-specific features.
Usage
Constructor
Parameters
The font family name as a string (e.g., “Arial”, “Helvetica”, “Times New Roman”). If not specified, uses the default family from the theme.
The font height in pixels as an integer. If not specified, uses the default size from the theme.
Font weight. Options:
"normal"- Regular weight"bold"- Boldface
Font slant style. Options:
"roman"- Normal, unslanted text"italic"- Italic text
Whether the text should be underlined. Set to
True for underlined text, False for normal.Whether the text should have a line through it. Set to
True for overstruck text, False for normal.Methods
configure()
Update font properties after creation.family(str, optional) - Change the font familysize(int, optional) - Change the font sizeweight(str, optional) - Change the font weightslant(str, optional) - Change the font slantunderline(bool, optional) - Change underline settingoverstrike(bool, optional) - Change overstrike setting
cget()
Retrieve current font property values.attribute_name(str) - Name of the attribute to retrieve (e.g., “size”, “family”, “weight”)
copy()
Create a deep copy of the font object.CTkFont instance with identical properties
Notes
- CTkFont uses pixel-based sizing that remains consistent regardless of DPI scaling
- The
config()method is not available for CTkFont. Always useconfigure()instead - Font objects can be shared across multiple widgets and will update all widgets when configured
- For more information on tkinter fonts, see the tkinter font documentation