tkinter.font — Tkinter 字体包裹器

源代码: Lib/tkinter/font.py


The tkinter.font module provides the Font class for creating and using named fonts.

The different font weights and slants are:

tkinter.font. NORMAL
tkinter.font. BOLD
tkinter.font. ITALIC
tkinter.font. ROMAN
class tkinter.font. 字体 ( root = None , font = None , 名称 = None , exists = False , ** 选项 )

The Font class represents a named 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.

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):

系列 - font family i.e. Courier, Times
size - font size
size is positive it is interpreted as size in points.
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)