Skip to main content
`Ctrl`+`K`

# `Plot3DWidget`: OpenGL scene widget

This module provides a Qt widget embedding an OpenGL scene.

## `Plot3DWidget`

class Plot3DWidget(parent=None, f=<WindowType.Widget: 0>)

  Bases: `OpenGLWidget`

  OpenGL widget with a 3D viewport and an overview.

  sigInteractiveModeChanged

    Signal emitted when the interactive mode has changed

  sigStyleChanged

    Signal emitted when the style of the scene has changed

    It provides the updated property.

  sigSceneClicked

    Signal emitted when the scene is clicked with the left mouse button.

    It provides the (x, y) clicked mouse position in logical widget pixel coordinates.

  class FogMode(*values)

    Bases: `Enum`

    Different mode to render the scene with fog

    NONE = 'none'

      No fog effect

    LINEAR = 'linear'

      Linear fog through the whole scene

  setInteractiveMode(mode)

    Set the interactive mode.

    Parameters:

      mode (str) – The interactive mode: ‘rotate’, ‘pan’ or None

  getInteractiveMode()

    Returns the interactive mode in use.

    Return type:

      str

  setProjection(projection)

    Change the projection in use.

    Parameters:

      projection (str) – In ‘perspective’, ‘orthographic’.

  getProjection()

    Return the current camera projection mode as a str.

    See `setProjection()`

  setBackgroundColor(color)

    Set the background color of the OpenGL view.

    Parameters:

      color (QColor, str or array-like of 3 or 4 float in [0., 1.] or uint8) – RGB color of the isosurface: name, #RRGGBB or RGB values

  getBackgroundColor()

    Returns the RGBA background color (QColor).

  setFogMode(mode)

    Set the kind of fog to use for the whole scene.

    Parameters:

      mode (Union[str,FogMode]) – The mode to use

    Raises:

      ValueError – If mode is not supported

  getFogMode()

    Returns the kind of fog in use

    Returns:

      The kind of fog in use

    Return type:

      FogMode

  isOrientationIndicatorVisible()

    Returns True if the orientation indicator is displayed.

    Return type:

      bool

  setOrientationIndicatorVisible(visible)

    Set the orientation indicator visibility.

    Parameters:

      visible (bool) – True to show

  centerScene()

    Position the center of the scene at the center of rotation.

  resetZoom(face='front')

    Reset the camera position to a default.

    Parameters:

      face (str) – The direction the camera is looking at: side, front, back, top, bottom, right, left. Default: front.

  sizeHint(self) → QSize
  initializeGL()

    Override to implement OpenGL initialization.

  paintGL()

    Override to implement OpenGL rendering.

  resizeGL(width, height)

    Override to implement resize of OpenGL framebuffer.

    Parameters:

      - width (int) – Width in device-independent pixels

      - height (int) – Height in device-independent pixels

  grabGL()

    Renders the OpenGL scene into a numpy array

    Returns:

      OpenGL scene RGB rasterization

    Return type:

      QImage

  wheelEvent(self, a0: QWheelEvent | None)
  keyPressEvent(self, a0: QKeyEvent | None)
  keyReleaseEvent(event)

    Catch Ctrl key release

  mousePressEvent(self, a0: QMouseEvent | None)
  mouseMoveEvent(self, a0: QMouseEvent | None)
  mouseReleaseEvent(self, a0: QMouseEvent | None)