IDLE: Tiny font on HiDPI display #75681
Copy link
Copy link
Closed
Labels
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = 'https://github.com/terryjreedy'
closed_at = <Date 2018-10-20.23:35:31.284>
created_at = <Date 2017-09-17.18:54:06.429>
labels = ['expert-IDLE', 'type-bug']
title = 'IDLE: Tiny font on HiDPI display'
updated_at = <Date 2018-10-21.09:05:30.847>
user = 'https://github.com/serhiy-storchaka'bugs.python.org fields:
activity = <Date 2018-10-21.09:05:30.847>
actor = 'taleinat'
assignee = 'terry.reedy'
closed = True
closed_date = <Date 2018-10-20.23:35:31.284>
closer = 'terry.reedy'
components = ['IDLE']
creation = <Date 2017-09-17.18:54:06.429>
creator = 'serhiy.storchaka'
dependencies = []
files = ['47141', '47148', '47149', '47155']
hgrepos = []
issue_num = 31500
keywords = ['patch']
message_count = 32.0
messages = ['302381', '302417', '302463', '302464', '302471', '302477', '302509', '302563', '302566', '302572', '302573', '302574', '302579', '302580', '302595', '302605', '302607', '302640', '302672', '302695', '313199', '313204', '313206', '315664', '315666', '316455', '316485', '316506', '316574', '328177', '328182', '328200']
nosy_count = 6.0
nosy_names = ['terry.reedy', 'taleinat', 'ned.deily', 'serhiy.storchaka', 'louielu', 'cheryl.sabella']
pr_nums = ['3639', '3664', '3665', '3686', '6585', '10015']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue31500'
versions = ['Python 2.7']Reactions are currently unavailable
Activity
serhiy-storchaka commentedon Sep 17, 2017
My new laptop has a HiDPI display (3840x2160). IDLE (as well as other Tk applications) looks ugly on it. The font of menu and dialogs is tiny. The font used in editor and shell looks normal size. I use Linux with X Window.
It seems to me this issue doesn't have solution. Related links:
https://wiki.tcl.tk/41949
https://core.tcl.tk/tk/tktview/0917069c05e9c354a27c8105a7a22264090b9274
https://stackoverflow.com/questions/34132203/scaling-of-tkinter-gui-in-4k-38402160-resolution
serhiy-storchaka commentedon Sep 18, 2017
PR 3639 adapts the receipt from [1]. I'm not sure that it doesn't add regressions on low-DPI displays.
[1] https://wiki.tcl.tk/8488
terryjreedy commentedon Sep 18, 2017
The TkFixedFont initially used in Shell and editor has its size set to 10 if initially negative. Users can only replace this with a real font, not another of tk's abstract fonts.
On windows, the sizes of the nearly 20 fonts touched by the patch range from 8 to 12. So no possible regression there. If the sizes on Linux were in the range -8 to -12, then the effect is to replace the size with numbers around 10 instead of exactly 10 (as IDLE currently does). But from what you said on the patch, the negative numbers are not exactly the negative of their real size, but are tuned for positioning.
Cheryy, Louie, and Ned: the patch needs to be test on multiple *nix machines, especially on OSX, to make sure it does not mess up on standard monitors. A quick 'git pr 3639' and 'python -m test.test_idle' would be helpful.
csabella commentedon Sep 18, 2017
Tests run on Ubuntu. The menubar is bigger now though, so it's default is
different than before. Maybe that was the only way to fix it, but it's now
about twice as big as the shell font.
csabella commentedon Sep 18, 2017
Attached screen prints of configdialog. It's messed up.
terryjreedy commentedon Sep 18, 2017
Thank you Cheryl. That is enough to reject the patch is it is now.
The negative sizes are pixels. I think it might be better to multiply them by a systems specific factor, but only when needed.
One might wish that the scaling should be handled automatically, in tkinter if not in tk itself. But it was mentioned in one of the links that displays do not always report their dpi correctly.
One possibility is a tkinter calibration app that displays a 500 or 1000 pixel line (user selects) and asks the user to input the physical length (centimeters or inches). (Some games do something similar with brightness.)
To check whether a tkinter scaling app could be used, I sized Serhiy's image so that the sample font in the Settings Font tab matched the sample font in a real box. The system font around it is tiny but readable, especially with a magnifier.
This is a tkinter issue, not only an IDLE issue, but IDLE is a good test app, with realistically complex dialogs. Lacking a Python-wide fix, something could be added to the Font tab -- for instance a dpi multiplier that defaults to one. It would only be used if not 1.0.
I reread config.IdleConf.GetFont. Rather than manipulate one of tk's default fonts ('TkFixedFont'), it creates a normal font sized in points. It uses 'TkFixedFont' as a handy key for finding a system-specific sure-to-exist fixed pitch font: "actualFont = Font.actual(f)", where f is a TkFixedFont instance. Thus it does not affect the dialogs.
It would be helpful to know if HiDPI screens on Windows have a problem.
bpo-31496 is about test_configdialog failing on the same HiDPI screen.
serhiy-storchaka commentedon Sep 19, 2017
The Keys and General tabs are messed up even more on my computer. Some sections are just not visible. This is because The dialog window uses hardcoded size in pixels, it is too small for all content. After removing the hardcoded size all looks good.
terryjreedy commentedon Sep 19, 2017
Cheryl, what do you get with
If it is less than 1.2, then Serhiy's revised patch should leave config dialog as it should be.
terryjreedy commentedon Sep 19, 2017
New changeset d6e2f26 by Terry Jan Reedy in branch 'master':
bpo-31500: Removed fixed size of IDLE config dialog. (bpo-3664)
d6e2f26
terryjreedy commentedon Sep 19, 2017
New changeset 97be149 by Terry Jan Reedy (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31500: Removed fixed size of IDLE config dialog. (GH-3664) (bpo-3665)
97be149
csabella commentedon Sep 20, 2017
11 remaining items
serhiy-storchaka commentedon Mar 4, 2018
What about 2.7?
terryjreedy commentedon Mar 4, 2018
I take it you want this reopened. I have not touched IDLE 2.7 for over a year, but since a) there have been no complaints about the patch in released 3.6.3/4, b) we recommend the same tk 8.5.18 for both 2.7 and 3.6, and c) this is a crippling regression upon equipment upgrade, I will review and manually test on Windows a combined backport of both PRs first tested on a Linux or Mac system. It should be tested on a HiDPI system before a merge.
terryjreedy commentedon Apr 23, 2018
I guess I was not clear enough that I will test on Windows after someone else does a backport that works on Linux.
serhiy-storchaka commentedon Apr 23, 2018
You promised to make backports to 2.7 when did the mass files renaming. The simple cherry-picking doesn't work, and I even don't know what files in 2.7 should be changed.
serhiy-storchaka commentedon May 13, 2018
Something was changed on my computer (I upgraded the OS twice since creating this issue), and now I don't see any difference between patched and unpatched 2.7. Terry, could you please test whether there are any visible effects on Windows?
terryjreedy commentedon May 14, 2018
Does IDLE now work on your HiDPI screen without the patch? or does it not work even with the patch?
I just got a 2.7 worktree working with Python built. 2.7.15+ comes with 8.5.19 instead of 8.5.15. IDLE runs as I expect and windows look normal, as with 3.x, both before and after the patch.
If calling fix_scaling ever causes anyone a problem on some particular combination of OS, Python, and Tk versions, they could neutralize it by adding the following after the current definition.
def fix_scaling: pass
serhiy-storchaka commentedon May 14, 2018
Seems IDLE now works on my HiDPI screen without the patch. It looks the same as IDLE in 3.x with the patch.
terryjreedy commentedon May 14, 2018
My inclination, then, is to close this issue and PR until there is a demonstrated need for change and a test machine to verify the fix for 2.7 and 8.5.19.
terryjreedy commentedon Oct 20, 2018
New changeset 18c44cc by Terry Jan Reedy (Cheryl Sabella) in branch '2.7':
[2.7] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639) (GH-6585)
18c44cc
terryjreedy commentedon Oct 20, 2018
New changeset f125d78 by Terry Jan Reedy in branch '2.7':
bpo-31500: Default fonts now are scaled on HiDPI displays. (bpo-10015)
f125d78
taleinat commentedon Oct 21, 2018
Just tested on a 13" Retina MacBook Pro (2560x1600), everything looks fine.