Added ViewBox.setBackgroundColor()

This commit is contained in:
Luke Campagnola 2014-02-12 02:16:00 -05:00
parent 283a568693
commit 9677b1492b
2 changed files with 10 additions and 0 deletions

View File

@ -35,6 +35,7 @@ pyqtgraph-0.9.9 [unreleased]
when plots do not fit inside the widget. when plots do not fit inside the widget.
- Added BarGraphItem.shape() to allow better mouse interaction - Added BarGraphItem.shape() to allow better mouse interaction
- Added MeshData.cylinder - Added MeshData.cylinder
- Added ViewBox.setBackgroundColor()
Bugfixes: Bugfixes:
- PlotCurveItem now has correct clicking behavior--clicks within a few px - PlotCurveItem now has correct clicking behavior--clicks within a few px

View File

@ -285,6 +285,15 @@ class ViewBox(GraphicsWidget):
self.updateViewRange() self.updateViewRange()
self.sigStateChanged.emit(self) self.sigStateChanged.emit(self)
def setBackgroundColor(self, color):
"""
Set the background color of the ViewBox.
If color is None, then no background will be drawn.
"""
self.background.setVisible(color is not None)
self.state['background'] = color
self.updateBackground()
def setMouseMode(self, mode): def setMouseMode(self, mode):
""" """