|
22 | 22 | import sys
|
23 | 23 |
|
24 | 24 | from configparser import ConfigParser
|
| 25 | +from tkinter import TkVersion |
25 | 26 | from tkinter.font import Font, nametofont
|
26 | 27 |
|
27 | 28 | class InvalidConfigType(Exception): pass
|
@@ -688,13 +689,16 @@ def GetFont(self, root, configType, section):
|
688 | 689 | bold = self.GetOption(configType, section, 'font-bold', default=0,
|
689 | 690 | type='bool')
|
690 | 691 | if (family == 'TkFixedFont'):
|
691 |
| - f = Font(name='TkFixedFont', exists=True, root=root) |
692 |
| - actualFont = Font.actual(f) |
693 |
| - family = actualFont['family'] |
694 |
| - size = actualFont['size'] |
695 |
| - if size < 0: |
696 |
| - size = 10 # if font in pixels, ignore actual size |
697 |
| - bold = actualFont['weight']=='bold' |
| 692 | + if TkVersion < 8.5: |
| 693 | + family = 'Courier' |
| 694 | + else: |
| 695 | + f = Font(name='TkFixedFont', exists=True, root=root) |
| 696 | + actualFont = Font.actual(f) |
| 697 | + family = actualFont['family'] |
| 698 | + size = actualFont['size'] |
| 699 | + if size < 0: |
| 700 | + size = 10 # if font in pixels, ignore actual size |
| 701 | + bold = actualFont['weight']=='bold' |
698 | 702 | return (family, size, 'bold' if bold else 'normal')
|
699 | 703 |
|
700 | 704 | def LoadCfgFiles(self):
|
|
0 commit comments