8000 Merge pull request #15613 from anntzer/qtsize · matplotlib/matplotlib@330a054 · GitHub
[go: up one dir, main page]

Skip to content

Commit 330a054

Browse files
authored
Merge pull request #15613 from anntzer/qtsize
Revert "Don't bother with manually resizing the Qt main window."
2 parents 5495b88 + 17acd62 commit 330a054

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,16 @@ def __init__(self, canvas, num):
572572
statusbar_label = QtWidgets.QLabel()
573573
self.window.statusBar().addWidget(statusbar_label)
574574
self.toolbar.message.connect(statusbar_label.setText)
575+
tbs_height = self.toolbar.sizeHint().height()
576+
else:
577+
tbs_height = 0
578+
579+
# resize the main window so it will display the canvas with the
580+
# requested size:
581+
cs = canvas.sizeHint()
582+
sbs = self.window.statusBar().sizeHint()
583+
height = cs.height() + tbs_height + sbs.height()
584+
self.window.resize(cs.width(), height)
575585

576586
self.window.setCentralWidget(self.canvas)
577587

0 commit comments

Comments
 (0)
0