The following attributes apply to all VPython objects:
visible If false (0),
object is not displayed; e.g. ball.visible = 0
Use ball.visible = 1 to make the ball
visible again.
frame Place this object
into a specified frame, as in ball = sphere(frame
= f1)
display When you start
a VPython program, for convenience Visual creates a display window and names
it scene. By default, objects you create go
into that display window. You can choose to put an object in a different display
like this:
__class__ Name of the class
of object. For example, ball.__class__ is sphere
is true if ball is a sphere object. There are
two underscores before and after the word class.
In a list of visible objects provided by scene.objects,
if obj is in this list you can determine the
class of the object with obj.__class__.
__copy()__ Makes a copy
of an object. There are two underscores before and after the copy().
Without any arguments, this results in creating a second object in the exact
same position as the first, which is probably not what you want. The __copy__()
function takes a list of keyword=value argument pairs which are applied to
the new object before making it visible. For example, to clone an object from
one display to another, you would execute: new_object
= old_object.__copy__( display=new_display). Restriction: If the original
object is within a frame, and the new object is on a different display, you
must supply both a new display and a new frame for the new object (the new
frame may be None). This is due to the restriction that an object may not
be located within a frame that is in a separate display. The attribute __members__
used to give a list of all the object's attributes but is no longer available
in VPython. Its main use was in copying objects.
Here is an example that uses the __copy()__ function. The following routine
copies all of the Visual objects currently existing in one display into
a previously defined second display: