diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py index 9132a859f90f..bc31d31e699b 100644 --- a/lib/matplotlib/backends/_backend_tk.py +++ b/lib/matplotlib/backends/_backend_tk.py @@ -431,6 +431,17 @@ def _get_toolbar(self): return toolbar def resize(self, width, height): + max_size = 1_400_000 # the measured max on xorg 1.20.8 was 1_409_023 + + if (width > max_size or height > max_size) and sys.platform == 'linux': + raise ValueError( + 'You have requested to resize the ' + f'Tk window to ({width}, {height}), one of which ' + f'is bigger than {max_size}. At larger sizes xorg will ' + 'either exit with an error on newer versions (~1.20) or ' + 'cause corruption on older version (~1.19). We ' + 'do not expect a window over a million pixel wide or tall ' + 'to be intended behavior.') self.canvas._tkcanvas.configure(width=width, height=height) def show(self):
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: