Skip to content

Document idlelib.util.fix_win_hidpi() #159139

Description

@BarbTurnip437

Documentation

I see a lot of people having problems with windows's high dpi problem on tkinter,
and I just discovered minutes ago that this undocumented function exists and can solve the issue,
I wish It could be documented ()
qwq

Activity

  1. changed the title [-]Document `idlelib.util.fix_win_hidpi`[/-] [+]Document `idlelib.util.fix_win_hidpi()`[/+] on Oct 10, 2026
  2. aryan9948 commented on Oct 10, 2026

    @aryan9948

    I’d like to investigate this documentation improvement. Since idlelib is described as an implementation package, should fix_win_hidpi() be documented in the IDLE developer documentation, or is the intention to make it discoverable as a utility for Tkinter applications? I’ll check the existing documentation structure before proposing a change.

  3. terryjreedy commented on Oct 11, 2026

    @terryjreedy
    Member

    I think the win_hidpi fix should be in tkinter itself or even python. When Steve Dower gave me the fix (pretty much as written), we briefly discussed the possibility. As I remember, there are 3 options for the parameter passed and the proper value might depend on details of what Python itself does. So it might be that tkinter should always do the fix on Windows, before the first tk operation. If not, it could give users the option to set it immediately after import. The font, word-break, and x11 paste fixes are also not IDLE specific.

    When we implemented PEP-434, clarifying the status of idlelib, we discussed documenting a few functions or classes for public use and decided not to. However, the IDLE doc has a section Developing Tkinter Applications. Pending a move to tkinter, I might accept something like the following. (But would anyone ever look here?)

    Idlelib.util has some short, private 'fix_x' functions that address tk issues with high dpi monitors and cross-compatibility.
    If useful for other tkinter applications, they can be copied into their source tree.

    If such lines becomes obsolete, they could be changed to refer to tkinter or removed.

    To make reading util.py clearer, regardless a doc note, the current fix_x comment should be expanded to something like:

    # The following fix_x functions address tk shortcomings on hidpi monitors and cross-system compatibility.
    # They should each be applied once per process.
    

    Also, the issue numbers should be labed 'gh-' after making sure that they are not bpo numbers.

    Comments?

  4. terryjreedy commented on Oct 11, 2026

    @terryjreedy
    Member

    This is a spinoff of #119459, where this was mentioned. I mentioned the possibility of doing something there.

  5. BarbTurnip437 commented on Oct 11, 2026

    @BarbTurnip437
    Author
    Comments?
    

    i guess i see......
    should close?

  6. terryjreedy commented on Oct 11, 2026

    @terryjreedy
    Member

    I will at least change the comment and issue references in util.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions