opynsim.ui#

opynsim.ui.show_hello_ui() None#

Displays OPynSim’s ‘hello world’ user interface in a window.

Blocks and runs the GUI main loop until the window is closed.

opynsim.ui.show_model_in_state(model: opynsim._core.Model, model_state: opynsim._core.ModelState, *, dimensions: tuple[int, int] = (640, 480), background_color: collections.abc.Sequence[float] = [1.0, 1.0, 1.0, 1.0], zoom_to_fit: bool = True, draw_floor: bool = False) None#

Displays an interactive visualizer for the given opynsim.Model + opynsim.ModelState in a window.

Blocks and runs the GUI main loop until the window is closed.

Parameters:
  • model (opynsim.Model) – The model to show.

  • model_state (opynsim.ModelState) – The state of the model to show. Should be realized to at least opynsim.ModelStateStage.REPORT.

  • dimensions (tuple[int, int]) – The desired output resolution (width, height) of the window in device-independent pixels.

  • background_color – The desired background color of the rendered scene, specified as normalized floats representing RGBA.

  • zoom_to_fit (bool) – Tells the ui to automatically set up the camera to focus on the center of the bounds of the scene at a distance that can see the entire scene.

  • draw_floor (bool) – Draws a chequered floor.