pg.plot() and pg.PlotWidget() now accept background argument
ImageExporter correctly handles QBrush with style=NoBrush
This commit is contained in:
parent
824e4b378b
commit
42553854a9
@ -281,7 +281,7 @@ def plot(*args, **kargs):
|
||||
#if len(args)+len(kargs) > 0:
|
||||
#w.plot(*args, **kargs)
|
||||
|
||||
pwArgList = ['title', 'labels', 'name', 'left', 'right', 'top', 'bottom']
|
||||
pwArgList = ['title', 'labels', 'name', 'left', 'right', 'top', 'bottom', 'background']
|
||||
pwArgs = {}
|
||||
dataArgs = {}
|
||||
for k in kargs:
|
||||
|
@ -17,7 +17,11 @@ class ImageExporter(Exporter):
|
||||
scene = item.scene()
|
||||
else:
|
||||
scene = item
|
||||
bg = scene.views()[0].backgroundBrush().color()
|
||||
bgbrush = scene.views()[0].backgroundBrush()
|
||||
bg = bgbrush.color()
|
||||
if bgbrush.style() == QtCore.Qt.NoBrush:
|
||||
bg.setAlpha(0)
|
||||
|
||||
self.params = Parameter(name='params', type='group', children=[
|
||||
{'name': 'width', 'type': 'int', 'value': tr.width(), 'limits': (0, None)},
|
||||
{'name': 'height', 'type': 'int', 'value': tr.height(), 'limits': (0, None)},
|
||||
|
@ -40,10 +40,12 @@ class PlotWidget(GraphicsView):
|
||||
For all
|
||||
other methods, use :func:`getPlotItem <pyqtgraph.PlotWidget.getPlotItem>`.
|
||||
"""
|
||||
def __init__(self, parent=None, **kargs):
|
||||
"""When initializing PlotWidget, all keyword arguments except *parent* are passed
|
||||
def __init__(self, parent=None, background='default', **kargs):
|
||||
"""When initializing PlotWidget, *parent* and *background* are passed to
|
||||
:func:`GraphicsWidget.__init__() <pyqtgraph.GraphicsWidget.__init__>`
|
||||
and all others are passed
|
||||
to :func:`PlotItem.__init__() <pyqtgraph.PlotItem.__init__>`."""
|
||||
GraphicsView.__init__(self, parent)
|
||||
GraphicsView.__init__(self, parent, background=background)
|
||||
self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||
self.enableMouse(False)
|
||||
self.plotItem = PlotItem(**kargs)
|
||||
|
Loading…
Reference in New Issue
Block a user