bpo-37039: Make IDLE's Zoom Height adjust to users' screens by taleinat · Pull Request #13678 · python/cpython (original) (raw)

  1. Initial full-screen flash: really annoying. If we cannot find something we have missed so far (I don't expect this), it might be better to pause it a bit. Idea: maximize the root window with text such as "Calibrating zoom". Or do this on startup as a splash screen with text such as "IDLE is measuring\nyour screen." The latter might require pulling startup code from pyshell into a separate startup file that does not immediately import all of idlelib. I don't currently know where the startup time goes, and if the time between creating root and displaying a shell or editor screen could be made long enough with pyshell as startup.

IMO the number of users who actually use "zoom height" is small, so I don't think this justifies annoying 100% of the users with a maximized (i.e. almost full-screen) splash screen.

I've been working around and through the limitations of Tk as far as possible, and have reached the limit of what is possible, to the best of my understanding and research. To do better would require using OS APIs directly, e.g. as done by the screeninfo library, but IMO this is not warranted in this case.

  1. User maximizes the window and then 'zooms'. Nothing happens as the window is already zoomed and zoom/restore do not change width. 'Zoom' is not changed to 'Restore'. Perhaps a comparison needs to remove '='? Perhaps when no calibration is stored, max can be stored and 'zoom' flipped?

I've currently made "zoom height" be a no-op when the window isn't in the "normal" state, e.g. when it is maximized. I can handle the case where the screen is already maximized if you find the current "do nothing" behavior surprising. Or I can just add a .bell() call to make it clear that the command failed.

  1. Moving between a window between multiple screens. Given multiple screens, how common is this?

These days, with widespread use of laptops, it is very common: People connect and disconnect to/from external screens, using them instead of/in addition to the laptop screen. Also, multi-monitor desktop setups are increasingly common for developers, and often they do not have the same resolution, e.g. having one monitor situated in a "portrait" orientation.

... We should be able to identify screens sufficiently by size and scaling. It does suggest that a startup check is not enough, and that both zoom and scale calibration need to be per window.

The latest commit in the PR handles this properly. (Note that as far as Tk is concerned, scaling simply means a different resolution.)