◐ Shell
clean mode source ↗

bpo-31500: IDLE: Scale default fonts on HiDPI displays. by serhiy-storchaka · Pull Request #3639 · python/cpython

I was about to ask, how to we avoid enlarging the fonts when they should not be enlarged, as on Cheryl's system. How did you pick 1.2? On my system, with a 27" 2560 x 1440 widescreen, which I believe is not 'HiDPI', it is 1.333. In my display settings, I selected "Enlarge fonts...: 125%". I don't know if that affect tk's reported scaling factor.

How about adding and not sys.platform.beginswith('win') to the condition?

On some Linux systems, the reported size of at least TkFixedFont is 0. See bpo-26673, which changed the GetFont line 'if size < 0' to '<= 0'. Do you have any such thing on your machine? What does the following show?

try:
    import tkinter as tk
    import tkinter.messagebox
    from tkinter import font
except:
    import Tkinter as tk
    import tkFont as font

root = tk.Tk()
for name in font.names(root):
    fnt = font.Font(root=root, name=name, exists=True)
    print((name, font.Font.actual(fnt)['family'], fnt['size']))

For me:
('fixed', 'Courier New', 10)
('oemfixed', 'Terminal', 9)
('TkDefaultFont', 'Segoe UI', 9)
('TkMenuFont', 'Segoe UI', 9)
('ansifixed', 'Courier New', 10)
('systemfixed', 'Fixedsys', 9)
('TkHeadingFont', 'Segoe UI', 9)
('device', 'System', 12)
('TkTooltipFont', 'Segoe UI', 9)
('defaultgui', 'MS Shell Dlg', 8)
('TkTextFont', 'Segoe UI', 9)
('ansi', 'MS Sans Serif', 8)
('TkCaptionFont', 'Segoe UI', 9)
('system', 'System', 10)
('TkSmallCaptionFont', 'Segoe UI', 9)
('TkFixedFont', 'Courier New', 10)
('TkIconFont', 'Segoe UI', 9)
On my config dialog, 'Segoe UI' 9 is used. It is not the same as the title bar.