Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE: adjust DPI before Tk() for htests. #78156

Closed
terryjreedy opened this issue Jun 27, 2018 · 5 comments
Closed

IDLE: adjust DPI before Tk() for htests. #78156

terryjreedy opened this issue Jun 27, 2018 · 5 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 33975
Nosy @terryjreedy, @miss-islington
PRs
  • bpo-33975: Avoid small type when running IDLE's htests. #7944
  • [3.7] bpo-33975: Avoid small type when running IDLE's htests. (GH-7944) #7951
  • [3.6] bpo-33975: Avoid small type when running IDLE's htests. (GH-7944) #7952
  • 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-06-27.05:32:49.595>
    created_at = <Date 2018-06-27.02:22:16.529>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7']
    title = 'IDLE: adjust DPI before Tk() for htests.'
    updated_at = <Date 2018-06-27.05:32:49.594>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2018-06-27.05:32:49.594>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2018-06-27.05:32:49.595>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2018-06-27.02:22:16.529>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33975
    keywords = ['patch']
    message_count = 5.0
    messages = ['320531', '320536', '320543', '320544', '320545']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'miss-islington']
    pr_nums = ['7944', '7951', '7952']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33975'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @terryjreedy
    Copy link
    Member Author

    bpo-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.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes labels Jun 27, 2018
    @terryjreedy terryjreedy self-assigned this Jun 27, 2018
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Jun 27, 2018
    @terryjreedy terryjreedy changed the title IDLE: only adjust DPI before Tk() IDLE: adjust DPI before Tk() Jun 27, 2018
    @terryjreedy
    Copy link
    Member Author

    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.

    @terryjreedy terryjreedy changed the title IDLE: adjust DPI before Tk() IDLE: adjust DPI before Tk() for htests. Jun 27, 2018
    @terryjreedy
    Copy link
    Member Author

    New changeset 3c8043d by Terry Jan Reedy in branch 'master':
    bpo-33975: Avoid small type when running IDLE's htests. (GH-7944)
    3c8043d

    @miss-islington
    Copy link
    Contributor

    New changeset 5d2d9d7 by Miss Islington (bot) in branch '3.6':
    bpo-33975: Avoid small type when running IDLE's htests. (GH-7944)
    5d2d9d7

    @terryjreedy
    Copy link
    Member Author

    Both PRs have been merged.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants