{"library":"pythreejs","title":"pythreejs","description":"pythreejs provides interactive 3D graphics for the Jupyter Notebook and JupyterLab environments, leveraging the popular Three.js JavaScript library and Jupyter Widgets. It allows Python users to create and manipulate 3D scenes directly within their notebooks. The current version is 2.4.2, and it typically sees a few releases per year, often tracking updates in Three.js or Jupyter widgets.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pythreejs"],"cli":null},"imports":["from pythreejs import Scene","from pythreejs import PerspectiveCamera","from pythreejs import WebGLRenderer","from pythreejs import Mesh","from pythreejs import BoxGeometry","from pythreejs import MeshStandardMaterial","from pythreejs import OrbitControls"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pythreejs import Scene, PerspectiveCamera, WebGLRenderer, Mesh, BoxGeometry, MeshStandardMaterial, OrbitControls\nfrom IPython.display import display\n\n# Create a basic scene with a red cube\nscene = Scene(children=[\n    Mesh(\n        geometry=BoxGeometry(1, 1, 1),\n        material=MeshStandardMaterial(color='red')\n    )\n])\n\n# Set up a camera\ncamera = PerspectiveCamera(position=[3, 3, 3], fov=60, aspect=1.5)\n\n# Create a WebGL renderer and attach the scene and camera\n# Add OrbitControls for interactive camera movement\nrenderer = WebGLRenderer(\n    scene=scene,\n    camera=camera,\n    controls=[OrbitControls(controlling=camera)]\n)\nrenderer.width = 600\nrenderer.height = 400\n\n# Display the interactive 3D renderer in a Jupyter environment\ndisplay(renderer)","lang":"python","description":"This quickstart demonstrates how to create a simple 3D scene with a red cube, set up a camera, and render it using `pythreejs` within a Jupyter Notebook or JupyterLab environment. It also includes `OrbitControls` for interactive camera navigation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}