documentation index ◦ reference manual ◦ function index

# ShowingSwitch

Function: | ShowingSwitch | (*args, **kwargs):

This chooses a displayable to show based on which images are being shown on the screen. It expects an even number of positional arguments. Odd positional arguments are expected to be image names, while even positional arguments are expected to be displayables. An image matches if it is the prefix of a shown image. If the image name is None, it always matches. It is an error if no match occurs.

This takes the keyword argument layer, which specifies the layer that will be checked to see if the images appear on it, defaulting to "master". Other keyword arguments are used to position the chosen displayable.

Shown image names are tracked by the predictive image loading mechanism, and so ShowingSwitch will properly predictively load images.

## Example

    init:
        $ e = Character(
            'Eileen',
            color="#c8ffc8",
            window_left_padding=160,
            show_side_image=ShowingSwitch(
                "eileen happy", "eileen_side_happy.png",
                "eileen vhappy", "eileen_side_vhappy.png",
                "eileen concerned", "eileen_side_concerned.png",
                None, Null(),
                xalign=0.0, yalign=1.0))

documentation index ◦ reference manual ◦ function index