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

Skip to content

Commit d4e113a

Browse files
committed
Improve backend_qt4 so it displays figures with the correct size
svn path=/trunk/matplotlib/; revision=8294
1 parent e986cc7 commit d4e113a

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2010-05-04 Improve backend_qt4 so it displays figures with the
2+
correct size - DSD
3+
14
2010-04-20 Added generic support for connecting to a timer for events. This
25
adds TimerBase, TimerGTK, TimerQT, TimerWx, and TimerTk to
36
the backends and a new_timer() method to each backend's

lib/matplotlib/backends/backend_qt4.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,13 @@ def __init__( self, canvas, num ):
318318
QtCore.QObject.connect(self.toolbar, QtCore.SIGNAL("message"),
319319
self.window.statusBar().showMessage)
320320

321+
# resize the main window so it will display the canvas with the
322+
# requested size:
323+
cs = canvas.sizeHint()
324+
tbs = self.toolbar.sizeHint()
325+
sbs = self.window.statusBar().sizeHint()
326+
self.window.resize(cs.width(), cs.height()+tbs.height()+sbs.height())
327+
321328
self.window.setCentralWidget(self.canvas)
322329

323330
if matplotlib.is_interactive():

0 commit comments

Comments
 (0)