Skip to content

Commit 342a48a

Browse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PR #22898: Only set Tk scaling-on-map for Windows systems
1 parent a841f5f commit 342a48a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/backends/_backend_tk.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ def __init__(self, figure=None, master=None, resize_callback=None):
177177
self._tkcanvas.create_image(w//2, h//2, image=self._tkphoto)
178178
self._resize_callback = resize_callback
179179
self._tkcanvas.bind("<Configure>", self.resize)
180-
self._tkcanvas.bind("<Map>", self._update_device_pixel_ratio)
180+
if sys.platform == 'win32':
181+
self._tkcanvas.bind("<Map>", self._update_device_pixel_ratio)
181182
self._tkcanvas.bind("<Key>", self.key_press)
182183
self._tkcanvas.bind("<Motion>", self.motion_notify_event)
183184
self._tkcanvas.bind("<Enter>", self.enter_notify_event)
@@ -212,7 +213,7 @@ def filter_destroy(event):
212213
self._tkcanvas.focus_set()
213214

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

0 commit comments

Comments
 (0)