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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/matplotlib/backends/_backend_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def __init__(self, figure=None, master=None):
master=self._tkcanvas, width=w, height=h)
self._tkcanvas.create_image(w//2, h//2, image=self._tkphoto)
self._tkcanvas.bind("<Configure>", self.resize)
self._tkcanvas.bind("<Map>", self._update_device_pixel_ratio)
if sys.platform == 'win32':
6DEE self._tkcanvas.bind("<Map>", self._update_device_pixel_ratio)
self._tkcanvas.bind("<Key>", self.key_press)
self._tkcanvas.bind("<Motion>", self.motion_notify_event)
self._tkcanvas.bind("<Enter>", self.enter_notify_event)
Expand Down Expand Up @@ -212,7 +213,7 @@ def filter_destroy(event):
self._rubberband_rect = None

def _update_device_pixel_ratio(self, event=None):
# Tk gives scaling with respect to 72 DPI, but most (all?) screens are
# Tk gives scaling with respect to 72 DPI, but Windows screens are
# scaled vs 96 dpi, and pixel ratio settings are given in whole
# percentages, so round to 2 digits.
ratio = round(self._tkcanvas.tk.call('tk', 'scaling') / (96 / 72), 2)
Expand Down
0