Skip to content

Commit 65828b5

Browse files
committed
Fix bug when resizing qt4 figure window.
Resizing window didn't account for toolbar and status bar heights.
1 parent cfd50c8 commit 65828b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backends/backend_qt4.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ def __init__( self, canvas, num ):
318318
# requested size:
319319
cs = canvas.sizeHint()
320320
sbs = self.window.statusBar().sizeHint()
321-
self.window.resize(cs.width(), cs.height()+tbs_height+sbs.height())
321+
self._status_and_tool_height = tbs_height+sbs.height()
322+
height = cs.height() + self._status_and_tool_height
323+
self.window.resize(cs.width(), height)
322324

323325
self.window.setCentralWidget(self.canvas)
324326

@@ -364,7 +366,7 @@ def _get_toolbar(self, canvas, parent):
364366

365367
def resize(self, width, height):
366368
'set the canvas size in pixels'
367-
self.window.resize(width, height)
369+
self.window.resize(width, height + self._status_and_tool_height)
368370

369371
def show(self):
370372
self.window.show()

0 commit comments

Comments
 (0)