8000 Merge pull request #22898 from QuLogic/no-tk-scale · matplotlib/matplotlib@c407510 · GitHub
[go: up one dir, main page]

Skip to content

Commit c407510

Browse files
authored
Merge pull request #22898 from QuLogic/no-tk-scale
Only set Tk scaling-on-map for Windows systems
2 parents e26efa5 + f1f8094 commit c407510

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ def __init__(self, figure=None, master=None):
175175
master=self._tkcanvas, width=w, height=h)
176176
self._tkcanvas.create_image(w//2, h//2, image=self._tkphoto)
177177
self._tkcanvas.bind("<Configure>", self.resize)
178-
self._tkcanvas.bind("<Map>", self._update_device_pixel_ratio)
178+
if sys.platform == 'win32':
179+
self._tkcanvas.bind("<Map>", self._update_device_pixel_ratio)
179180
self._tkcanvas.bind("<Key>", self.key_press)
180181
self._tkcanvas.bind("<Motion>", self.motion_notify_event)
181182
self._tkcanvas.bind("<Enter>", self.enter_notify_event)
@@ -212,7 +213,7 @@ def filter_destroy(event):
212213
self._rubberband_rect = None
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)
0