From 20db5866cb253b4ead9e444e99771bc82516b1aa Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 6 Nov 2019 16:55:19 -0500 Subject: [PATCH] Backport PR #15613: Revert "Don't bother with manually resizing the Qt main window." --- lib/matplotlib/backends/backend_qt5.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index c32bd03f3369..3b5ae14bcef8 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -572,6 +572,16 @@ def __init__(self, canvas, num): statusbar_label = QtWidgets.QLabel() self.window.statusBar().addWidget(statusbar_label) self.toolbar.message.connect(statusbar_label.setText) + tbs_height = self.toolbar.sizeHint().height() + else: + tbs_height = 0 + + # resize the main window so it will display the canvas with the + # requested size: + cs = canvas.sizeHint() + sbs = self.window.statusBar().sizeHint() + height = cs.height() + tbs_height + sbs.height() + self.window.resize(cs.width(), height) self.window.setCentralWidget(self.canvas)