Overview of Python & VPython

  "Welcome to VPython" tutorial

  Introductory Videos

  Pictures of 3D objects




  VPython 7 web site
  VPython license

Additional Attributes

The following attributes apply to all VPython objects:

visible If False, object is not displayed; e.g. ball.visible = False
Use ball.visible = True to make the ball visible again.

rotate() An object B can be rotated with B.rotate(angle=theta, axis=a, origin=org). By default, the axis is B.axis. and the origin is B.pos. Nothing is returned; this just changes the axis of the object and also rotates the "up" attribute, to remain at right angles to the axis.

bounding_box() You can obtain the "bounding box" of an object B as bb = B.bounding_box(), where bb is a list of eight 3D corners of a box that would enclose the object B, no matter what pos/axis/size attributes it currently has. (Not yet available in VPython 7.)

frame Place this object into a specified frame, as in ball = sphere(frame = f1) NOTE: frame is not yet available in Web VPython.

canvas When you start a VPython program, for convenience VPython creates a canvas and names it scene. By default, objects you create go into that canvas. You can choose to put an object in a different canvas like this:

scene2 = canvas( title = "Act IV, Scene 2" )
rod = cylinder( canvas = scene2 )

make_trail You can specify that a trail be left behind a moving arrow, box, cone, cylinder, ellipsoid, pyramid, ring, or sphere object. For details, see Leaving a Trail.

Executing myscene = canvas.get_selected() returns a reference to the canvas in which objects are currently being created. Given a specific canvas named scene2, scene2.select() makes scene2 be the "selected canvas", so that objects will be drawn into scene2 by default.

See Controlling One or More VPython Canvases for more information on creating and manipulating display objects.