GraphicsView — pyqtgraph 0.11.0rc0 documentation

# GraphicsView

class `pyqtgraph.` `GraphicsView`(parent=None, useOpenGL=None, background='default')

  Re-implementation of QGraphicsView that removes scrollbars and allows unambiguous control of the viewed coordinate range. Also automatically creates a GraphicsScene and a central QGraphicsWidget that is automatically scaled to the full view geometry.

  This widget is the basis for `PlotWidget`, `GraphicsLayoutWidget`, and the view widget in `ImageView`.

  By default, the view coordinate system matches the widget’s pixel coordinates and automatically updates when the view is resized. This can be overridden by setting autoPixelRange=False. The exact visible range can be set with setRange().

  The view can be panned using the middle mouse button and scaled using the right mouse button if enabled via enableMouse() (but ordinarily, we use ViewBox for this functionality).

  `__init__`(parent=None, useOpenGL=None, background='default')

    Arguments: |
    parent | Optional parent widget
    useOpenGL | If True, the GraphicsView will use OpenGL to do all of its rendering. This can improve performance on some systems, but may also introduce bugs (the combination of QGraphicsView and QGLWidget is still an ‘experimental’ feature of Qt)
    background | Set the background color of the GraphicsView. Accepts any single argument accepted by `mkColor`. By default, the background color is determined using the ‘backgroundColor’ configuration option (see `setConfigOptions`).

  `close`(self) → bool
  `dragEnterEvent`(self, event: PySide2.QtGui.QDragEnterEvent)
  `keyPressEvent`(self, event: PySide2.QtGui.QKeyEvent)
  `leaveEvent`(self, event: PySide2.QtCore.QEvent)
  `mouseMoveEvent`(self, event: PySide2.QtGui.QMouseEvent)
  `mousePressEvent`(self, event: PySide2.QtGui.QMouseEvent)
  `mouseReleaseEvent`(self, event: PySide2.QtGui.QMouseEvent)
  `paintEvent`(self, event: PySide2.QtGui.QPaintEvent)
  `pixelSize`()

    Return vector with the length and width of one view pixel in scene coordinates

  `render`(self, painter: PySide2.QtGui.QPainter, target: PySide2.QtCore.QRectF = Default(QRectF), source: PySide2.QtCore.QRect = Default(QRect), aspectRatioMode: PySide2.QtCore.Qt.AspectRatioMode = PySide2.QtCore.Qt.AspectRatioMode.KeepAspectRatio)

    render(self, target: PySide2.QtGui.QPaintDevice, targetOffset: PySide2.QtCore.QPoint = Default(QPoint), sourceRegion: PySide2.QtGui.QRegion = Default(QRegion), renderFlags: PySide2.QtWidgets.QWidget.RenderFlags = Instance(QWidget.RenderFlags(QWidget.DrawWindowBackground | QWidget.DrawChildren)))

  `resizeEvent`(self, event: PySide2.QtGui.QResizeEvent)
  `scale`(self, sx: float, sy: float)
  `scaleToImage`(image)

    Scales such that pixels in image are the same size as screen pixels. This may result in a significant performance increase.

  `setAntialiasing`(aa)

    Enable or disable default antialiasing. Note that this will only affect items that do not specify their own antialiasing options.

  `setBackground`(background)

    Set the background color of the GraphicsView. To use the defaults specified py pyqtgraph.setConfigOption, use background=’default’. To make the background transparent, use background=None.

  `setCentralWidget`(item)

    Sets a QGraphicsWidget to automatically fill the entire view (the item will be automatically resize whenever the GraphicsView is resized).

  `translate`(self, dx: float, dy: float)
  `viewRect`()

    Return the boundaries of the view in scene coordinates

  `wheelEvent`(self, event: PySide2.QtGui.QWheelEvent)