Notebooks#
- class pyenki.buffer.EnkiRemoteFrameBuffer#
Bases:
RemoteFrameBuffer,HasCameraRenders a world in a jupyter notebook by calling
pyenki.viewer.render().- world#
The world to display
- Type:
pyenki.World | None
Example:
>>> import pyenki >>> # configure a world >>> world = ... >>> from pyenki.buffer import EnkiRemoteFrameBuffer >>> view = EnkiRemoteFrameBuffer(world=world) >>> view.move_camera(target_position=(0, 0), target_altitude=5, camera_yaw=1, camera_pitch=-0.5, target_distance=40) >>> view
- __init__(world: World | None = None, **camera_config: Unpack[CameraConfig])#
Constructs a new instance.
- Parameters:
world – The world
camera_config – The camera configuration.
- request_draw_sync() None#
Similar to
jupyter_rfb.RemoteFrameBuffer.request_draw()but works outside of an even loop.
- resize(width: int, height: int) None#
Resizes the buffer
- Parameters:
width – The width in pixels
height – The height in pixels
- run(time_step: float, duration: float = -1, factor: float = 1, synch: Collection[EnkiRemoteFrameBuffer] = ()) None#
Runs a simulation and updates the view for a while.
- Parameters:
time_step – The time step of the simulation
duration – The duration of the simulation
factor – The real-time factor. If larger than one, the simulation will run faster then real-time.
synch – Which other buffers should be redrawn.
- async run_async(time_step: float, duration: float = -1, factor: float = 1, synch: Collection[EnkiRemoteFrameBuffer] = ()) None#
Runs a simulation and updates the view for a while.
- Parameters:
time_step – The time step of the simulation
duration – The duration of the simulation
factor – The real-time factor. If larger than one, the simulation will run faster then real-time.
synch – Which other buffers should be redrawn.