MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / GetFont

Method GetFont

tools/python-3.11.9-amd64/Lib/idlelib/config.py:730–754  ·  view source on GitHub ↗

Retrieve a font from configuration (font, font-size, font-bold) Intercept the special value 'TkFixedFont' and substitute the actual font, factoring in some tweaks if needed for appearance sakes. The 'root' parameter can normally be any valid Tkinter widget.

(self, root, configType, section)

Source from the content-addressed store, hash-verified

728 return allHelpSources
729
730 def GetFont(self, root, configType, section):
731 """Retrieve a font from configuration (font, font-size, font-bold)
732 Intercept the special value 'TkFixedFont' and substitute
733 the actual font, factoring in some tweaks if needed for
734 appearance sakes.
735
736 The 'root' parameter can normally be any valid Tkinter widget.
737
738 Return a tuple (family, size, weight) suitable for passing
739 to tkinter.Font
740 """
741 family = self.GetOption(configType, section, 'font', default='courier')
742 size = self.GetOption(configType, section, 'font-size', type='int',
743 default='10')
744 bold = self.GetOption(configType, section, 'font-bold', default=0,
745 type='bool')
746 if (family == 'TkFixedFont'):
747 f = Font(name='TkFixedFont', exists=True, root=root)
748 actualFont = Font.actual(f)
749 family = actualFont['family']
750 size = actualFont['size']
751 if size <= 0:
752 size = 10 # if font in pixels, ignore actual size
753 bold = actualFont['weight'] == 'bold'
754 return (family, size, 'bold' if bold else 'normal')
755
756 def LoadCfgFiles(self):
757 "Load all configuration files."

Callers 9

update_fontMethod · 0.80
load_font_cfgMethod · 0.80
update_fontMethod · 0.80
update_fontMethod · 0.80
__init__Method · 0.80
ResetFontMethod · 0.80
test_font_setMethod · 0.80
test_get_fontMethod · 0.80

Calls 3

GetOptionMethod · 0.95
FontClass · 0.90
actualMethod · 0.80

Tested by 2

test_font_setMethod · 0.64
test_get_fontMethod · 0.64