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

Skip to content

Commit e6367c9

Browse files
committed
Don't bother with manually resizing the Qt main window.
The presence of FigureCanvasQT.sizeHint is sufficient to get a correct figure size; Qt properly determines the entire window size based on that. This behavior is already tested by test_backend_qt::test_dpi_ratio_change, and one can also manually check that the patch does not change physical window sizes when creating figures of various figsize=(?).
1 parent c19ebd6 commit e6367c9

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

lib/matplotlib/backends/backend_qt5.py

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

585575
self.window.setCentralWidget(self.canvas)
586576

0 commit comments

Comments
 (0)