If you're new to Python
and VPython: Introduction

A VPython tutorial

Pictures of 3D objects

What's new in VPython 6

VPython web site
VPython license
Python web site
Math module (sqrt etc.)
Numpy module (arrays)


The pyramid object has a rectangular cross section and tapers to a point. The following statement will display a pyramid with the center of the rectangular base at (5,2,0), pointing parallel to the x axis with a base that is 6 high (in y), 4 wide (in z), and with a length 12 from base to tip:

pyramid(pos=(5,2,0), size=(12,6,4))

The pyramid object has the following attributes and default values, like those for cylinders: pos which is the center of the rectangular base (0,0,0), x (0), y(0), z(0), axis (1,0,0), length (1), color (1,1,1) which is color.white, red (1), green (1), blue (1), opacity (1), material, and up (0,1,0). Additional pyramid attributes:

height In the y direction in the simple case, default is 1

width In the z direction in the simple case, default is 1

size (length, height, width), default is (1,1,1)
mypyramid.size=(20,10,12) sets length=20, height=10, width=12

Note that the pos attribute for cylinder, arrow, cone, and pyramid corresponds to one end of the object, whereas for a box, sphere, or ring it corresponds to the center of the object.

If you include make_trail=True when you create the object, a trail will be left behind the object as you move it. For related options, see Leaving a Trail.

See description of Additional Attributes available for all 3D display objects.