8000 Only set Tk scaling-on-map for Windows systems by QuLogic · Pull Request #22898 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Only set Tk scaling-on-map for Windows systems #22898

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

Merged
merged 1 commit into from
Apr 29, 2022

Conversation

QuLogic
Copy link
Member
@QuLogic QuLogic commented Apr 26, 2022

PR Summary

On Windows, the DPI that Tk sees is 96 for regular screens and some multiple of that for HiDPI screens.

On Linux, the DPI is the true DPI (or at least what the display server tells it is true), and doesn't have anything to do with HiDPI.

On macOS, the DPI appears closer to 72 by default. If anyone with a retina screen could check what the value of self._tkcanvas.tk.call('tk', 'scaling') is in FigureCanvasTk._update_device_pixel_ratio, then perhaps we could enable HiDPI-on-startup there, at least.

PR Checklist

Tests and Styling

  • [n/a] Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [n/a] New features are documented, with examples if plot related.
  • [n/a] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [n/a] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [n/a] Documentation is sphinx and numpydoc compliant (the docs should build without error).

@QuLogic QuLogic added this to the v3.5.2 milestone Apr 26, 2022
@QuLogic
Copy link
Member Author
QuLogic commented Apr 26, 2022

Oops, I reversed the title...

@QuLogic QuLogic changed the title Only set Tk scaling-on-map for non-Windows systems Only set Tk scaling-on-map for Windows systems Apr 26, 2022
On Windows, the DPI that Tk sees is 96 for regular screens and some
multiple of that for HiDPI screens. On Linux, the DPI is the true DPI
(or at least what the display server tells it is true), and doesn't have
anything to do with HiDPI. On macOS, the DPI appears closer to 72 by
default.
@greglucas
Copy link
Contributor

On macOS, the DPI appears closer to 72 by default. If anyone with a retina screen could check what the value of self._tkcanvas.tk.call('tk', 'scaling') is in FigureCanvasTk._update_device_pixel_ratio, then perhaps we could enable HiDPI-on-startup there, at least.

I get 1.0005 for my external monitor and 0.9994 for my HiDPI retina screen. Maybe the HiDPI comes from somewhere else?

@QuLogic
Copy link
Member Author
QuLogic commented Apr 29, 2022

OK, that's good to know. I think it makes sense to disable this scaling on macOS then. We were currently doing effectively 1.005 / 1.33 (which is 96/72 from Windows), meaning we'd be underscaling macOS.

I think for HiDPI on macOS, I'll have to somehow link up with the same code in the macosx ObjC side, in a similar manner to Windows.

Copy link
Contributor
@richardsheridan richardsheridan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still works on my hi/lo dpi Windows setup!

@tacaswell tacaswell merged commit c407510 into matplotlib:main Apr 29, 2022
@tacaswell
Copy link
Member

@meeseeksdev backport to v3.5.x

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Apr 29, 2022
@QuLogic QuLogic deleted the no-tk-scale branch April 29, 2022 22:10
QuLogic added a commit that referenced this pull request Apr 29, 2022
…898-on-v3.5.x

Backport PR #22898 on branch v3.5.x (Only set Tk scaling-on-map for Windows systems)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0