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:
scene2 = display( title = "Act IV, Scene 2" )rod = cylinder( display = scene2 )
__class__ Name of the class of object. For example, ball.__class__ == sphere is true (you can also refer to 'sphere' as a character string). 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__.
__members__ List of all the object's attributes; for example, ball.__members__ is ['axis', 'blue', 'color', .....]. There are two underscores before and after the word members.
Here is an example that uses these attributes. The following routine copies all of the Visual objects currently existing in one display ("scene1") into a previously defined second display ("scene2"):
def copyobjects(scene1,scene2):
# Copy all Visual objects from scene1 into scene2
scene2.select()
for obj in scene1.objects:
newobj = obj.__class__() # create object in scene2
for member in obj.__members__:
if member == 'display': continue # avoid putting into scene1
setattr(newobj,member,getattr(obj,member))
See Controlling One or More Visual Display Windows for more information on creating and manipulating display objects.