classification
Title: IDLE: adjust DPI before Tk() for htests.
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2018-06-27 02:22 by terry.reedy, last changed 2018-06-27 05:32 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7944 merged terry.reedy, 2018-06-27 02:56
PR 7951 open miss-islington, 2018-06-27 04:08
PR 7952 open miss-islington, 2018-06-27 04:09
Messages (5)
msg320531 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-27 02:22
#33656 patched PyShell to call SetProcessDpiAwareness on Windows nearly first thing, *at module level*, well before calling tkinter.Tk().  The Microsoft docs warn that making the Windows API call after starting the graphics system may not work as expected.  With tk 8.6,8, the result is sharp, but small type -- perhaps 7 points instead of 10.  This issue is about avoiding type shrinkage, both when running the htest suite as a whole and when running the test for an individual file after running the unittests.

To do that in any process, pyshell must be imported before Tk() is called.  The patch adds the following to htest.py.
import idlelib.pyshell  # Set Windows DPI awareness before Tk().

I will add the same where needed to the top of if __name__ == '__main__': clauses in idlelib modules, before running unittests.
msg320536 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-27 03:00
Because of import caching, subsequent pyshell imports, after the first, do not re-call the Windows API.

Apparently, 'root.destroy()' undoes a previous 'root = Tk()', but not a previous pyshell import.  Since IDLE unittests always destroy roots, a unittest before an htest does not require anything more to work right.

Since part of the purpose of human-viewed tests is to determine that widgets look right, it is important that they look the same for testing
as when running IDLE.
msg320543 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-27 04:07
New changeset 3c8043d8fac4c0d05c0ba9e4e555e2f3165f2fe0 by Terry Jan Reedy in branch 'master':
bpo-33975: Avoid small type when running IDLE's htests. (GH-7944)
https://github.com/python/cpython/commit/3c8043d8fac4c0d05c0ba9e4e555e2f3165f2fe0
msg320544 - (view) Author: miss-islington (miss-islington) Date: 2018-06-27 04:48
New changeset 5d2d9d7c08819c7fbdfd7906858609e5070c20dd by Miss Islington (bot) in branch '3.6':
bpo-33975: Avoid small type when running IDLE's htests. (GH-7944)
https://github.com/python/cpython/commit/5d2d9d7c08819c7fbdfd7906858609e5070c20dd
msg320545 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-27 05:32
Both PRs have been merged.
History
Date User Action Args
2018-06-27 05:32:49terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg320545

stage: patch review -> resolved
2018-06-27 04:48:57miss-islingtonsetnosy: + miss-islington
messages: + msg320544
2018-06-27 04:09:39miss-islingtonsetpull_requests: + pull_request7560
2018-06-27 04:08:40miss-islingtonsetpull_requests: + pull_request7559
2018-06-27 04:07:33terry.reedysetmessages: + msg320543
2018-06-27 03:01:01terry.reedysettitle: IDLE: adjust DPI before Tk() -> IDLE: adjust DPI before Tk() for htests.
2018-06-27 03:00:07terry.reedysetmessages: + msg320536
2018-06-27 02:56:01terry.reedysetkeywords: + patch
pull_requests: + pull_request7553
2018-06-27 02:41:46terry.reedysettitle: IDLE: only adjust DPI before Tk() -> IDLE: adjust DPI before Tk()
2018-06-27 02:22:16terry.reedycreate