expyriment.io.Screen

class expyriment.io.Screen(colour, opengl, window_mode, window_size, no_frame, display, display_resolution)

A class implementing a screen output.

Each experiment and all stimuli need a screen instance to function. They are expecting this screen instance to be referenced in expyriment._active_exp.screen. Calling expyriment.control.initialise(exp) will automatically create such a screen instance and will additionally reference it in exp.screen for easy access.

__init__(colour, opengl, window_mode, window_size, no_frame, display, display_resolution)

Create and set up a screen output.

Parameters:
colour(int, int, int)

colour of the screen

openglint or bool

0/False - No OpenGL (no vsync / no blocking) 1 - OpenGL (vsync / no blocking) 2/True - OpenGL (vsync / blocking)

window_modebool

if screen should be a window, fullscreen otherwise

window_size(int, int)

size of the window in window_mode,

no_framebool

set True for windows (in window mode) with no frame; this parameter does not affect fullscreen mode

displayint

the display index to show the screen on (only has an effect if Pygame version >= 2)

display_resolutionlist or None

the resolution of the display

Notes

CAUTION: We discourage creating a screen instance manually!

property center_x

Getter for X-coordinate of the screen center.

Notes

Each initialised experiment has its one screen (exp.screen). Please use always the screen of your current experiment.

property center_y

Getter for the Y-coordinate of the screen center.

Notes

Each initialised experiment has its one screen (exp.screen). Please use always the screen of your current experiment.

clear()

Clear the screen.

This will reset the default experimental background colour.

property colour

Getter for colour.

property display

Getter for display.

property display_resolution

Getter for display_resolution.

property logging

Getter for logging.

property monitor_resolution

Getter for monitor_resolution.

DEPRECATED! Use display_resolution instead.

property no_frame

Getter for no_frame boolean

property opengl

Getter for opengl.

save(filename)

Save the content of the screen as a picture.

Parameters:
filenamestr

name of the file to write (possible extensions are BMP, TGA, PNG, or JPEG, with the default being TGA)

set_logging(onoff)

Set logging of this object on or off

Parameters:
onoffbool

set logging on (True) or off (False)

property size

Getter for the size of the screen.

Notes

Each initialised experiment has its one screen (exp.screen). Please use always the screen of your current experiment.

property surface

Getter for surface.

update(blocking=True)

Update the screen.

This will flip the display double buffer.

Parameters:
blockingbool, optional

whether to block on vertical retrace (OpenGL only; default=True)

update_stimuli(stimuli)

Update only some stimuli on the screen.

Parameters:
stimulilist

stimulus or a list of stimuli to update

Notes

This does only work for non OpenGL screens.

property window_mode

Getter for window_mode.

property window_size

Getter for window_size.