Author epaine
Recipients epaine, eryksun, taleinat, terry.reedy
Date 2020-09-11.15:39:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Following #33656, IDLE now "lies" to Windows and declares it has system DPI awareness to achieve a *sharper* look. System dpi is in effect:
DPI_AWARENESS_UNAWARE * Windows' zoom factor

Therefore, for IDLE to scale to the Windows' zoom/scale factor (System > Display > Scale and layout > Change the size of text, apps and other items), we need multiply the user's chosen font size by the zoom factor.

Unfortunately I cannot quote the docs about the multiplication I gave above but have extensively tested and found this to hold true (the docs are not very explanatory but a link and small snippet can be found below):

DPI_AWARENESS                Return value

We can use the GetDpiForWindow function to get the system dpi and divide it by 96 (DPI_AWARENESS_UNAWARE) to get the scale factor for the font. This keeps IDLE sharp while allowing it to respect the user's scaling preferences.

I was not intending for this to not be an option (it would happen on any Windows system unless the user digs through the source), though appreciate that it could cause a significant change on first-load.

I considered adding this logic to the method (which already modifies tkinter font size) but thought that users would not want this if their application was not set as DPI aware so settled on extending the idlelib.config.IdleConf.GetFont method instead.

My motivation for this is that currently that the user has to manually change their font size to match their Windows zoom factor (IDLE, without the user changing their font size, remains the same size regardless of what setting the user chooses as their scale factor). I have prepared a branch if this change is something that would interest you Terry.

Eryk, I have nosied you as I believe you are the person for Windows API calls (please do remove yourself if I am wrong).
Date User Action Args
2020-09-11 15:39:13epainesetrecipients: + epaine, terry.reedy, taleinat, eryksun
2020-09-11 15:39:13epainesetmessageid: <>
2020-09-11 15:39:13epainelinkissue41763 messages
2020-09-11 15:39:13epainecreate