Skip to content

Commit 04e87dd

Browse files
committed
Merge pull request #756 from tonysyu/fix-resize-bug
Fix bug when resizing qt4 figure window.
2 parents 88ffe1f + 65828b5 commit 04e87dd

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
@@ -325,7 +325,9 @@ def __init__( self, canvas, num ):
325325
# requested size:
326326
cs = canvas.sizeHint()
327327
sbs = self.window.statusBar().sizeHint()
328-
self.window.resize(cs.width(), cs.height()+tbs_height+sbs.height())
328+
self._status_and_tool_height = tbs_height+sbs.height()
329+
height = cs.height() + self._status_and_tool_height
330+
self.window.resize(cs.width(), height)
329331

330332
self.window.setCentralWidget(self.canvas)
331333

@@ -371,7 +373,7 @@ def _get_toolbar(self, canvas, parent):
371373

372374
def resize(self, width, height):
373375
'set the canvas size in pixels'
374-
self.window.resize(width, height)
376+
self.window.resize(width, height + self._status_and_tool_height)
375377

376378
def show(self):
377379
self.window.show()

0 commit comments

Comments
 (0)