from ..Qt import QtGui from ..graphicsItems.GraphicsLayout import GraphicsLayout from .GraphicsView import GraphicsView __all__ = ['GraphicsLayoutWidget'] class GraphicsLayoutWidget(GraphicsView): """ Convenience class consisting of a :class:`GraphicsView ` with a single :class:`GraphicsLayout ` as its central item. This class wraps several methods from its internal GraphicsLayout: :func:`nextRow ` :func:`nextColumn ` :func:`addPlot ` :func:`addViewBox ` :func:`addItem ` :func:`getItem ` :func:`addLabel ` :func:`addLayout ` :func:`removeItem ` :func:`itemIndex ` :func:`clear ` """ def __init__(self, parent=None, **kargs): GraphicsView.__init__(self, parent) self.ci = GraphicsLayout(**kargs) for n in ['nextRow', 'nextCol', 'nextColumn', 'addPlot', 'addViewBox', 'addItem', 'getItem', 'addLayout', 'addLabel', 'removeItem', 'itemIndex', 'clear']: setattr(self, n, getattr(self.ci, n)) self.setCentralItem(self.ci)