Home

If you're new to Python
and VPython: Introduction

A VPython tutorial

Pictures of 3D objects

What's new

Classic VPython web site
VPython license
Python web site

 

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.

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

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.