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

Skip to content

Commit 47be1cb

Browse files
authored
Merge pull request #17366 from anntzer/qtoolpos
Restrict Qt toolbars to top/bottom of canvas.
2 parents a0569fe + 0f31553 commit 47be1cb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,8 @@ class NavigationToolbar2QT(NavigationToolbar2, QtWidgets.QToolBar):
649649
def __init__(self, canvas, parent, coordinates=True):
650650
"""coordinates: should we show the coordinates on the right?"""
651651
QtWidgets.QToolBar.__init__(self, parent)
652+
self.setAllowedAreas(
653+
QtCore.Qt.TopToolBarArea | QtCore.Qt.BottomToolBarArea)
652654

653655
self._parent = parent
654656
self.coordinates = coordinates
@@ -888,6 +890,8 @@ class ToolbarQt(ToolContainerBase, QtWidgets.QToolBar):
888890
def __init__(self, toolmanager, parent):
889891
ToolContainerBase.__init__(self, toolmanager)
890892
QtWidgets.QToolBar.__init__(self, parent)
893+
self.setAllowedAreas(
894+
QtCore.Qt.TopToolBarArea | QtCore.Qt.BottomToolBarArea)
891895
self._toolitems = {}
892896
self._groups = {}
893897

0 commit comments

Comments
 (0)