PycturesPython 2D and 3D graphics, drawn in your web browser

Every scene below is a short Python program. Click one and it runs live in your browser, with its code beside it. Python gets the web's 2D canvas and three.js 3D, with the names JavaScript uses.

pip install pycturesStar on GitHubDocs
Solar System

Solar System3D

Planets in turning groups, a moon, a light at the sun and 2,000 stars.

Star Catcher

Star Catcher2D

A 2D game with emoji sprites, a score and lives.

Cube Spiral

Cube Spiral3D

400 cubes in a rainbow spiral, turning.

Cube Dodge

Cube Dodge3D

A 3D game with shadows, fog and the keyboard.

Bouncing Balls

Bouncing Balls2D

A 2D animation with trails and hsl() colours.

Textured Cube

Textured Cube3D

A picture from a file, wrapped round a turning crate.

Torus Knot

Torus Knot3D

One shape, lit, turning.

Live Chart

Live Chart2D

A line chart of a made-up sensor, updating as you watch.

Wave Grid

Wave Grid3D

225 cubes rising and falling like water.

Starfield

Starfield2D

Fly through 300 stars.

Lit Scene

Lit Scene3D

Shapes on a floor, with a spotlight and shadows.

Spiral Garden

Spiral Garden2D

200 dots placed on the golden angle, turning slowly.

From JavaScript: 3D

From JavaScript: 3D3D

The classic three.js spinning cube, line for line in Python.

From JavaScript: 2D

From JavaScript: 2D2D

A canvas example written the way JavaScript writes it.

Typing

Typing2D

Type and your words appear, with a box drawn to fit them.