diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index a6cc3b686554..a61de4f31e06 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -509,8 +509,7 @@ def __init__(self, canvas, num): # requested size: cs = canvas.sizeHint() sbs = self.window.statusBar().sizeHint() - self._status_and_tool_height = tbs_height + sbs.height() - height = cs.height() + self._status_and_tool_height + height = cs.height() + tbs_height + sbs.height() self.window.resize(cs.width(), height) self.window.setCentralWidget(self.canvas) @@ -554,8 +553,11 @@ def _get_toolbar(self, canvas, parent): return toolbar def resize(self, width, height): - 'set the canvas size in pixels' - self.window.resize(width, height + self._status_and_tool_height) + # these are Qt methods so they return sizes in 'virtual' pixels + # so we do not need to worry about dpi scaling here. + extra_width = self.window.width() - self.canvas.width() + extra_height = self.window.height() - self.canvas.height() + self.window.resize(width+extra_width, height+extra_height) def show(self): self.window.show()
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: