LabelItem — pyqtgraph 0.11.0rc0 documentation

# LabelItem

class `pyqtgraph.` `LabelItem`(text=' ', parent=None, angle=0, **args)

  GraphicsWidget displaying text. Used mainly as axis labels, titles, etc.

  Note: To display text inside a scaled view (ViewBox, PlotWidget, etc) use TextItem

  `__init__`(text=' ', parent=None, angle=0, **args)

    Bases: `GraphicsItem`, `QtGui.QGraphicsWidget`

    Extends QGraphicsWidget with several helpful methods and workarounds for PyQt bugs. Most of the extra functionality is inherited from `GraphicsItem`.

  `resizeEvent`(self, event: PySide2.QtWidgets.QGraphicsSceneResizeEvent)
  `setAttr`(attr, value)

    Set default text properties. See setText() for accepted parameters.

  `setText`(text, **args)

    Set the text and text properties in the label. Accepts optional arguments for auto-generating a CSS style string:

    Style Arguments: |
    color | (str) example: ‘CCFF00’
    size | (str) example: ‘8pt’
    bold | (bool)
    italic | (bool)

  `sizeHint`(self, which: PySide2.QtCore.Qt.SizeHint, constraint: PySide2.QtCore.QSizeF = Default(QSizeF)) → PySide2.QtCore.QSizeF