Package Scientific :: Package Visualization :: Module VMD :: Class Scene

[frames] | no frames]

# Class Scene

VMD scene

A VMD scene is a collection of graphics objects that can be loaded into VMD.

Instance Methods

VMDObject

__getitem__(self, item) Returns: the graphics object at the index position |

__init__(self, objects=None, **options) |

`int`

__len__(self) Returns: the number of graphics objects in the scene |

addObject(self, object) |

view(self, *args) Start VMD and load the scene |

writeToFile(self, filename, delete=False) Write the scene to a VMD script file |

Method Details

### __getitem__(self, item)
(Indexing operator)

Parameters:
  - `item` (`int`) - an index
Returns: VMDObject
  the graphics object at the index position

### __init__(self, objects=None, **options)
(Constructor)

Parameters:
  - `objects` (`list` or `NoneType`) - a list of graphics objects, or `None` for an empty scene
  - `options` - options as keyword arguments
  - `scale` (positive number) - a scale factor applied to all coordinates of geometrical objects except for molecule objects, which cannot be scaled

### __len__(self)
(Length operator)

Returns: `int`
  the number of graphics objects in the scene

### addObject(self, object)

Parameters:
  - `object` (VMDObject) - a graphics object to be added to the scene

### view(self, *args)

Start VMD and load the scene

Parameters:
  - `args` - not used, for compatibility with VRML modules only

### writeToFile(self, filename, delete=False)

Write the scene to a VMD script file

Parameters:
  - `filename` (`str`) - the name of the script
  - `delete` (`bool`) - flag that indicates whether the script should delete itself as its last action; used for temporary files