renpy/doc/reference/functions/Viewport - Ren'Py

documentation index ◦ reference manual ◦ function index

# Viewport

Function: | Viewport | (child, child_size=(None, None), offsets=(0.0, 0.0), style='viewport', **properties):

Creates a viewport displayable. A viewport restricts the size of its child, and allows the child to be displayed at an offset. This can be used for cropping and scrolling the images. Viewports have two methods, set_xoffset and set_yoffset, that allow the offsets to be changed, and hence the viewport to be scrolled.

child_size - The x and y size of the area the child is asked to render. If either is None, defaults to the size of this viewport.

offsets - The x and y offsets. If an integer, this is taken as a number of pixels. If a float, a fraction of the amount by which the child is larger then the viewport.

In general, viewports are only useful when the xmaximum and ymaximum properties are specified. You'll also want to set clipping=True on the style, although this is part of the default viewport style.

The set_xoffset and set_yoffset methods take a single argument, the new value of the offset.

## Example

TODO

documentation index ◦ reference manual ◦ function index