PyDocs

Nav

Graphical user interfaces with Tk

Font

  • Font(root=None, font=None, name=None, exists=False, **options)
The Font class represents a named font. Font instances are given unique names and can be specified by their family, size, and style configuration. Named fonts are Tk’s method of creating and identifying fonts as a single object, rather than specifying a font by its attributes with each occurrence.
Changed in 3.10
  • 3.10: Two fonts now compare equal (==) only when both are Font instances with the same name belonging to the same Tcl interpreter. arguments: font - font specifier tuple (family, size, options) name - unique font name exists - self points to existing named font if true additional keyword options (ignored if font is specified): family - font family, for example, Courier, Times size - font size If size is positive it is interpreted as size in points. If size is a negative number its absolute value is treated as size in pixels. weight - font emphasis (NORMAL, BOLD) slant - ROMAN, ITALIC underline - font underlining (0 - none, 1 - underline) overstrike - font strikeout (0 - none, 1 - strikeout)
Members of Font

a

actual
Return the actual attributes of the font, which may differ from the requested ones because of platform limitations.

c

cget
Retrieve an attribute of the font.
config
Modify one or more attributes of the font.
configure
Modify one or more attributes of the font.
copy
Return a distinct copy of the current font: a new named font with the same attributes but a different name, which can be reconfigured independently of the original.

m

measure
Return amount of space the text would occupy on the specified display when formatted in the current font, as an integer number of pixels.
metrics
Return font-specific data.
0 Examples
No examples for tkinter.font/Font.
See Also
No see-alsos for tkinter.font/Font
0 Notes
No notes for Font