expyriment.io.Screen

class expyriment.io.Screen(colour, open_gl, window_mode, window_size)[source]

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.intialize(exp) will automatically create such a screen instance and will additionally reference it in exp.screen for easy access.

Methods

__init__(colour, open_gl, window_mode, window_size)[source]

Create and set up a screen output.

Parameters:

colour : (int, int, int)

colour of the screen

open_gl : int or bool

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

window_mode : bool

if screen should be a window

window_size : (int, int)

size of the window in window_mode, full screen mode if size of window_mode[0]<=0

Notes

CAUTION: We discourage from creating a screen instance manually!

center_x

Getter for X-coordinate of the screen center.

Notes

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

center_y

Getter for the Y-coordinate of the screen center.

Notes

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

clear()[source]

Clear the screen.

This will reset the default experimental background colour.

colour

Getter for colour.

logging

Getter for logging.

monitor_resolution

Getter for monitor_resolution.

open_gl

Getter for open_gl.

save(filename)[source]

Save the content of the screen as a picture.

Parameters:

filename : str

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:

onoff : bool

set logging on (True) or off (False)

Notes

See also design.experiment.set_log_level fur further information about event logging.

size

Getter for the size of the screen.

Notes

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

surface

Getter for surface.

update()[source]

Update the screen.

This will flip the display double buffer.

update_stimuli(stimuli)[source]

Update only some stimuli on the screen.

Parameters:

stimuli : list

stimulus or a list of stimuli to update

Notes

This does only work for non OpenGL screens.

window_mode

Getter for window_mode.

window_size

Getter for window_size.