Created on 2018-06-27 02:22 by terry.reedy, last changed 2022-04-11 14:59 by admin. This issue is now closed.
#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.
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.
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
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
Both PRs have been merged.
stage: patch review -> resolved