Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
11 changes: 11 additions & 0 deletions lib/matplotlib/backends/_backend_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down