就业培训 下载中心 Wiki 联络 登录 注册 首页 Python 3.12.4 索引 模块 下一 上一 Python 标准库 采用 Tk 的图形用户界面 tkinter.font — Tkinter 字体包裹器 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 , name = 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) actual ( option = None , displayof = None ) ¶ Return the attributes of the font. cget ( option ) ¶ Retrieve an attribute of the font. config ( ** 选项 ) ¶ Modify attributes of the font. copy ( ) ¶ Return new instance of the current font. measure ( text , displayof = None ) ¶ Return amount of space the text would occupy on the specified display when formatted in the current font. If no display is specified then the main application window is assumed. metrics ( * 选项 , ** kw ) ¶ Return font-specific data. Options include: ascent - distance between baseline and highest point that a character of the font can occupy descent - distance between baseline and lowest point that a character of the font can occupy linespace - minimum vertical separation necessary between any two characters of the font that ensures no vertical overlap between lines. fixed - 1 if font is fixed-width else 0 tkinter.font. families ( root = None , displayof = None ) ¶ Return the different font families. tkinter.font. 名称 ( root = None ) ¶ Return the names of defined fonts. tkinter.font. nametofont ( name , root = None ) ¶ 返回 Font representation of a tk named font. 3.10 版改变: The root 参数被添加。
tkinter.font
源代码: Lib/tkinter/font.py
The tkinter.font module provides the Font class for creating and using named fonts.
Font
The different font weights and slants are:
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)
Return the attributes of the font.
Retrieve an attribute of the font.
Modify attributes of the font.
Return new instance of the current font.
Return amount of space the text would occupy on the specified display when formatted in the current font. If no display is specified then the main application window is assumed.
Return font-specific data. Options include:
character of the font can occupy
characters of the font that ensures no vertical overlap between lines.
fixed - 1 if font is fixed-width else 0
Return the different font families.
Return the names of defined fonts.
返回 Font representation of a tk named font.
3.10 版改变: The root 参数被添加。
tkinter.colorchooser — 颜色选取对话框
tkinter.colorchooser
Tkinter 对话框
键入搜索术语或模块、类、函数名称。