pygfx.utils.show.show

pygfx.utils.show.show(object: WorldObject, up=None, *, canvas=None, renderer=None, controller=None, camera=None, before_render=None, after_render=None, draw_function=None)

Display a WorldObject

This function provides you with the basic scaffolding to visualize a given WorldObject in a new window. While it does add scaffolding, it aims to be fully customizable so that you can replace each piece as needed.

Parameters:
  • object (gfx.WorldObject) – The object to show. If it is not a gfx.Scene then Display will wrap it into a new scene containing lights and a background.

  • up (ndarray) – If set, and object does not contain a controller, set the camera controller’s up vector to this value. canvas : WgpuCanvas The canvas used to display the object. If both renderer and canvas are set, then the renderer needs to use the set canvas.

  • canvas (WgpuCanvas) – The canvas used to display the object. If both renderer and canvas are set, then the renderer needs to use the set canvas.

  • renderer (gfx.Renderer) – The renderer to use while drawing the scene. If both renderer and canvas are set, then the renderer needs to use the set canvas.

  • controller (gfx.Controller) – The camera controller to use.

  • camera (gfx.Camera) – The camera to use. If not set, Display will use the first camera in the scene graph. If there is none, Display will create one.

  • before_render (Callable) – A callback that will be executed during each draw call before a new render is made.

  • after_render (Callable) – A callback that will be executed during each draw call after a new render is made.

  • draw_function (Callable) – Replaces the draw callback with a custom one. If set, both before_render and after_render will have no effect.

Notes

If you want to display multiple objects, use gfx.Group instead of gfx.Scene if you want lights and background to be added.