From 9677b1492b945f98fadc61763c2b36fa3b18a00c Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Wed, 12 Feb 2014 02:16:00 -0500 Subject: [PATCH] Added ViewBox.setBackgroundColor() --- CHANGELOG | 1 + pyqtgraph/graphicsItems/ViewBox/ViewBox.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 024abc52..cf7a4efd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -35,6 +35,7 @@ pyqtgraph-0.9.9 [unreleased] when plots do not fit inside the widget. - Added BarGraphItem.shape() to allow better mouse interaction - Added MeshData.cylinder + - Added ViewBox.setBackgroundColor() Bugfixes: - PlotCurveItem now has correct clicking behavior--clicks within a few px diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py index 06e0ec1f..adc089a7 100644 --- a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py +++ b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py @@ -285,6 +285,15 @@ class ViewBox(GraphicsWidget): self.updateViewRange() 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): """