# Class pyglet.graphics.Group

Known Subclasses:
  sprite.SpriteGroup, text.layout.ScrollableTextLayoutGroup, OrderedGroup, text.layout.TextLayoutGroup, text.layout.TextLayoutTextureGroup, NullGroup, TextureGroup

Group of common OpenGL state.

Before a vertex list is rendered, its group's OpenGL state is set; as are that state's ancestors' states. This can be defined arbitrarily on subclasses; the default state change has no effect, and groups vertex lists only in the order in which they are drawn.

## Methods

| __init__(self, parent=None) Create a group.
| set_state(self) Apply the OpenGL state change.
| unset_state(self) Repeal the OpenGL state change.
| set_state_recursive(self) Set this group and its ancestry.
| unset_state_recursive(self) Unset this group and its ancestry.

## Method Details

### __init__

(Constructor) __init__(self, parent=None)
Create a group.

Parameters:
  parent : Group
    Group to contain this group; its state will be set before this state's.

### set_state

set_state(self)

Apply the OpenGL state change.

The default implementation does nothing.

### unset_state

unset_state(self)

Repeal the OpenGL state change.

The default implementation does nothing.

### set_state_recursive

set_state_recursive(self)

Set this group and its ancestry.

Call this method if you are using a group in isolation: the parent groups will be called in top-down order, with this class's `set` being called last.

### unset_state_recursive

unset_state_recursive(self)

Unset this group and its ancestry.

The inverse of set_state_recursive.