[New-bugs-announce] [issue33656] IDLE: Turn on DPI awareness on Windows

Terry J. Reedy report at bugs.python.org
Sat May 26 19:14:50 EDT 2018


New submission from Terry J. Reedy <tjreedy at udel.edu>:

On IDLE-dev today, Elisha Paine, from Ranelagh School in England, wrote:
'''
I love IDLE (so simple and lightweight compared with other IDEs) and was just wondering if you could add the following code into pyshell.py (as I have done on mine) because, as you will be able to tell, it sets DPI awareness (and on my set-up makes the text a lot clearer)

import ctypes
try: ctypes.windll.shcore.SetProcessDpiAwareness (True)
except: pass
'''
On my Win 10 system with a 2560 x 1440 27" monitor, the text is noticeably sharper, some colors are brighter, and some characters are better formed.  The main effect seems to be from properly lining up vertical and horizontal lines with the pixels.  Lines that are supposed to be 1 or 2 pixels wide are just that, instead of bleeding over onto additional rows or columns.

By comparing IDLE's shell with Windows consoles with the same font and text, both for Command Prompt and Python x.y consoles, I determined that the Windows consoles have DPI awareness on.  The text is longer with it off and some character shapes, such as for 2 and 3, don't match, whereas text length and shape matches perfectly with it on.

At least some other apps also have DPO awareness on.  With the patch, the Open and Save As dialogs opened opened by from IDLE, via the tkinter/tk function, match those opened by Firefox.  Without the patch, not.

I like the improvement and with 3.7.0rc1 delayed, would like to get it in now.  My question for you Windows experts is 1. Is the above exactly the right thing? and 2. Should it be unconditional, or is there a possible downside?  Do consoles always have DPI awareness, or is it conditional on the monitor? 

I will make a PR as soon as I post this and get an issue number.

----------
assignee: terry.reedy
components: IDLE
messages: 317775
nosy: paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: IDLE: Turn on DPI awareness on Windows
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33656>
_______________________________________


More information about the New-bugs-announce mailing list