GLTextItem#

class pyqtgraph.opengl.GLTextItem(
parentItem=None,
**kwds,
)[source]#

Draws text in 3D.

__init__(
parentItem=None,
**kwds,
)[source]#

All keyword arguments are passed to setData()

align_text(
pos,
text,
font,
alignment,
)[source]#

Aligns the text at the given position according to the given alignment.

setData(
**kwds,
)[source]#

Update the data displayed by this item. All arguments are optional; for example it is allowed to update text while leaving colors unchanged, etc.

Arguments:

pos

(3,) array of floats specifying text location.

text

String to display.

color

QColor or array of ints [R,G,B] or [R,G,B,A]. (Default: Qt.white)

font

QFont (Default: QFont(‘Helvetica’, 16))

alignment

QtCore.Qt.AlignmentFlag (Default: QtCore.Qt.AlignmentFlag.AlignLeft | QtCore.Qt.AlignmentFlag.AlignBottom)

items

Optional list of dicts. Each dict specifies parameters for a single textitem: {‘pos’, ‘text’, ‘color’, ‘font’, ‘alignment’}. This allows rendering multiple text items. ‘pos’ and ‘text’ are required keys, the rest are optional.