# Class pyglet.text.layout.ScrollableTextLayout

    TextLayout --+
                 |
                ScrollableTextLayout

Known Subclasses:
  IncrementalTextLayout

Display text in a scrollable viewport.

This class does not display a scrollbar or handle scroll events; it merely clips the text that would be drawn in TextLayout to the bounds of the layout given by x, y, width and height; and offsets the text by a scroll offset.

Use view_x and view_y to scroll the text within the viewport.

## Methods

| __init__(self, document, width, height, multiline=False, dpi=None, batch=None, group=None) Create a text layout.
| begin_update(self) Indicate that a number of changes to the layout or document are about to occur. (Inherited from pyglet.text.layout.TextLayout)
| delete(self) Remove this layout from its batch. (Inherited from pyglet.text.layout.TextLayout)
| draw(self) Draw this text layout. (Inherited from pyglet.text.layout.TextLayout)
| end_update(self) Perform pending layout changes since begin_update. (Inherited from pyglet.text.layout.TextLayout)
| on_delete_text(self, start, end) Event handler for `AbstractDocument.on_delete_text`. (Inherited from pyglet.text.layout.TextLayout)
| on_insert_text(self, start, text) Event handler for `AbstractDocument.on_insert_text`. (Inherited from pyglet.text.layout.TextLayout)
| on_style_text(self, start, end, attributes) Event handler for `AbstractDocument.on_style_text`. (Inherited from pyglet.text.layout.TextLayout)

## Properties

int | x X coordinate of the layout.
int | y Y coordinate of the layout.
int | width Width of the layout.
int | height Height of the layout.
str | anchor_x Horizontal anchor alignment.
str | anchor_y Vertical anchor alignment.
int | view_x Horizontal scroll offset.
int | view_y Vertical scroll offset.
str | content_valign Vertical alignment of content within larger layout box. (Inherited from pyglet.text.layout.TextLayout)
| document (Inherited from pyglet.text.layout.TextLayout)
float | dpi Get DPI used by this layout. (Inherited from pyglet.text.layout.TextLayout)
bool | multiline Set if multiline layout is enabled. (Inherited from pyglet.text.layout.TextLayout)

## Instance Variables

Group | background_group = `OrderedGroup(0)` Rendering group for background color. (Inherited from pyglet.text.layout.TextLayout)
int | content_height Calculated height of the text in the layout. (Inherited from pyglet.text.layout.TextLayout)
int | content_width Calculated width of the text in the layout. (Inherited from pyglet.text.layout.TextLayout)
Group | foreground_decoration_group = `TextLayoutForegroundDecorationGr`...`` Rendering group for glyph underlines. (Inherited from pyglet.text.layout.TextLayout)
Group | foreground_group = `TextLayoutForegroundGroup(1)` Rendering group for glyphs. (Inherited from pyglet.text.layout.TextLayout)
Group | top_group = `<pyglet.text.layout.TextLayoutGroup object at 0xfa`...`` Top-level rendering group. (Inherited from pyglet.text.layout.TextLayout)

## Method Details

### __init__

(Constructor) __init__(self, document, width, height, multiline=False, dpi=None, batch=None, group=None)
Create a text layout.

Overrides:
  TextLayout.__init__

## Property Details

### x

X coordinate of the layout.

See also anchor_x.

Type:
  int

### y

Y coordinate of the layout.

See also anchor_y.

Type:
  int

### width

Width of the layout.

This property has no effect if multiline is False.

Type:
  int

### height

Height of the layout.

Type:
  int

### anchor_x

Horizontal anchor alignment.

This property determines the meaning of the x coordinate. It is one of the enumerants:

`"left"` (default)
  The X coordinate gives the position of the left edge of the layout.
`"center"`
  The X coordinate gives the position of the center of the layout.
`"right"`
  The X coordinate gives the position of the right edge of the layout.

For the purposes of calculating the position resulting from this alignment, the width of the layout is taken to be width if multiline is True, otherwise content_width.

Type:
  str

### anchor_y

Vertical anchor alignment.

This property determines the meaning of the y coordinate. It is one of the enumerants:

`"top"`
  The Y coordinate gives the position of the top edge of the layout.
`"center"`
  The Y coordinate gives the position of the center of the layout.
`"baseline"`
  The Y coordinate gives the position of the baseline of the first line of text in the layout.
`"bottom"` (default)
  The Y coordinate gives the position of the bottom edge of the layout.

For the purposes of calculating the position resulting from this alignment, the height of the layout is taken to be the smaller of height and content_height.

See also content_valign.

Type:
  str

### view_x

Horizontal scroll offset.

The initial value is 0, and the left edge of the text will touch the left side of the layout bounds. A positive value causes the text to "scroll" to the right. Values are automatically clipped into the range `[0, content_width - width]`

Type:
  int

### view_y

Vertical scroll offset.

The initial value is 0, and the top of the text will touch the top of the layout bounds (unless the content height is less than the layout height, in which case content_valign is used).

A negative value causes the text to "scroll" upwards. Values outside of the range `[height - content_height, 0]` are automatically clipped in range.

Type:
  int