Class GScene

This class represents a node in a scene graph. A scene graph node is just a collection of GObjects. By placing them in the scene graph node, you can rotate and translate them all at once. Scene graphs are a sophisticated concept that allow you to do advanced animation.

As GScene is a subclass of GObject you can nest scene graph nodes inside of other scene graph nodes. The result is a tree structure.

The attributes width and height are present in this object, but they are now read-only. These values are computed from the list of GObjects stored in the scene.

All GObjects stored in a GScene are drawn as if the point (x,y) is the origin.

Constructor

GScene(**keywords)

Creates a new scene graph node.

To use the constructor for this class, you should provide it with a list of keyword arguments that initialize various attributes. For example, to create a scene with shapes rect, tri, and circ, call the constructor:

GScene(children=[rect,tri,circ])

This class supports the same keywords as GObject, though some of them are unused, as the width and height attributes are now immutable.

Parameter:keywords (keys are attribute names) – dictionary of keyword arguments

Attributes

This class has all of the attributes of GObject. In addition, it has the following new or altered attributes.

children

The list of objects stored in this scene.

The objects are drawn as if (x,y) is the origin. Therefore, changing the attributes x and y will shift all of the children on the screen.

invariant: Value must be a list or tuple of GObject (possibly empty)

width

The horizontal width of this shape.

The value is the width of the smallest bounding box that contains all of the objects in this scene (and the center)

invariant: Value must be an int or float > 0

height

The vertical height of this path.

The value is the height of the smallest bounding box that contains all of the objects in this scene (and the center)

invariant: Value must be an int or float > 0