Viewer#

pyenki.viewer.use_native: bool | None = False#

Whether is using the native (C++) or the Python implementation of the viewer.

pyenki.viewer.init(share: bool = True) None#

Initializes the Qt runtime.

Parameters:

share (bool) – Whether to share all OpenGL contexts.

Should be called before creating any py:class:pyenki.viewer.WorldView.

pyenki.viewer.run(duration: SupportsFloat = -1) None#

Runs the Qt run-loop for a while.

Parameters:

duration (float) – The duration in seconds. Negative values are interpreted as infinite duration.

pyenki.viewer.cleanup() None#

Cleans up the Qt runtime.

pyenki.viewer.run_in_viewer(world: World, /, fps: SupportsFloat = 30, time_step: SupportsFloat = 0, factor: SupportsFloat = 1, helpers: bool = True, walls_height: SupportsFloat = 10, duration: SupportsFloat = -1, **camera_config: Unpack[CameraConfig]) None#

Runs a simulation while displaying it in real-time in a viewer.

Parameters:
  • world (World) – the world to display and run.

  • fps (float) – The framerate of the viewer in frames per second.

  • time_step (float) – The simulation time step in seconds.

  • factor (bool) – The real-time factor. If larger than one, the simulation will run faster then real-time.

  • helpers (bool) – Whether to display the helpers widgets.

  • walls_height (float) – the height of the world boundary in cm.

  • duration (float) – duration of the simulation in simulated time. Negative values are interpreted as infinite duration.

  • **camera_config (CameraConfig) – the camera configuration.