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