GLViewWidget#

class pyqtgraph.opengl.GLViewWidget(
*args,
devicePixelRatio=None,
**kwargs,
)[source]#

Bases: GLViewMixin, QOpenGLWidget

__init__(
*args,
devicePixelRatio=None,
**kwargs,
)[source]#
Basic widget for displaying 3D data
  • Rotation/scale controls

  • Axis/grid display

  • Export options

Arguments:

parent

(QObject, optional): Parent QObject. Defaults to None.

devicePixelRatio

No longer in use. High-DPI displays should automatically detect the correct resolution.

rotationMethod

(str): Mechanism to drive the rotation method, options are ‘euler’ and ‘quaternion’. Defaults to ‘euler’.

cameraPosition()#

Return current position of camera based on center, dist, elevation, and azimuth

clear()#

Remove all items from the scene.

initializeGL()#

Initialize items that were not initialized during addItem().

itemsAt(
region=None,
)#

Return a list of the items displayed in the region (x, y, w, h) relative to the widget.

orbit(
azim,
elev,
)#

Orbits the camera around the center position. azim and elev are given in degrees.

paintGL(
region=None,
viewport=None,
useItemNames=False,
)#

viewport specifies the arguments to glViewport. If None, then we use self.opts[‘viewport’] region specifies the sub-region of self.opts[‘viewport’] that should be rendered. Note that we may use viewport != self.opts[‘viewport’] when exporting.

pan(
dx,
dy,
dz,
relative='global',
)#

Moves the center (look-at) position while holding the camera in place.

Arguments:

dx

Distance to pan in x direction

dy

Distance to pan in y direction

dz

Distance to pan in z direction

relative

String that determines the direction of dx,dy,dz. If “global”, then the global coordinate system is used. If “view”, then the z axis is aligned with the view direction, and x and y axes are in the plane of the view: +x points right, +y points up. If “view-upright”, then x is in the global xy plane and points to the right side of the view, y is in the global xy plane and orthogonal to x, and z points in the global z direction.

Distances are scaled roughly such that a value of 1.0 moves by one pixel on screen.

pixelSize(
pos,
)#

Return the approximate size of a screen pixel at the location pos Pos may be a Vector or an (N,3) array of locations

readQImage()#

Read the current buffer pixels out as a QImage.

removeItem(
item,
)#

Remove the item from the scene.

reset()#

Initialize the widget state or reset the current state to the original state.

setBackgroundColor(
*args,
**kwds,
)#

Set the background color of the widget. Accepts the same arguments as mkColor().

class pyqtgraph.opengl.GLViewWidget.GLViewMixin(
*args,
rotationMethod='euler',
**kwargs,
)[source]#

Warning

The intention of this class is to provide users who want to use QOpenGLWindow instead of QOpenGLWidget but retain the benefits of GLViewWidget. Usage of this class should be considered experimental for the time being as it may change without warning in future releases.

Members:

__init__(
*args,
rotationMethod='euler',
**kwargs,
)[source]#

Mixin class providing functionality for GLViewWidget

Arguments:

rotationMethod

(str): Mechanism to drive the rotation method, options are ‘euler’ and ‘quaternion’. Defaults to ‘euler’.