Components¶
The following Components are available from Builder:
- Aperture Component
- Audio Validator Routine
- Brush Component
- Button Box Component
- Button Component
- Camera Component
- Code Component
- Counterbalance Routine
- Dots Component
- Eyetracker Calibration Routine
- Eyetracker Record Component
- Eyetracker Validation Routine
- Form Component
- Grating Component
- Image Component
- Joy Buttons Component
- Joystick Component
- Keyboard Component
- Microphone Component
- Mouse Component
- Movie Component
- Panorama Component
- Parallel Out Component
- Pavlovia Survey Routine
- Polygon Component
- Progress Component
- Region Of Interest Component
- Resource Manager Component
- Serial Out Component
- Slider Component
- Sound Component
- Static Component
- Text Component
- Textbox Component
- Unknown Component
- Unknown Plugin Component
- Variable Component
- Visual Validator Routine
- Voice Key Component
About Components¶
Routines in the Builder contain any number of components, which typically define the parameters of a stimulus or an input/output device.
Entering parameters¶
Most of the entry boxes for Component parameters simply receive text or numeric values or lists (sequences of values surrounded by square brackets) as input. In addition, the user can insert variables and code into most of these, which will be interpreted either at the beginning of the experiment or at regular intervals within it.
To indicate to PsychoPy® that the value represents a variable or python code, rather than literal text, it should be preceded by a $. For example, inserting intensity into the text field of the Text Component will cause that word literally to be presented, whereas $intensity will cause python to search for the variable called intensity in the script.
Variables associated with Loops can also be entered in this way (see “Using loops to update stimuli trial-by-trial” for further details). But it can also be used to evaluate arbitrary python code.
For example:
$random(2)
will generate a pair of random numbers$"yn"[randint(2)]
will randomly choose the first or second character (y or n)$globalClock.getTime()
will insert the current time in secs of the globalClock object$[sin(angle), cos(angle)]
will insert the sin and cos of an angle (e.g. into the x,y coords of a stimulus)
How often to evaluate the variable/code¶
If you do want the parameters of a stimulus to be evaluated by code in this way you need also to decide how often it should be updated. By default, the parameters of Components are set to be constant; the parameter will be set at the beginning of the experiment and will remain that way for the duration. Alternatively, they can be set to change either on every repeat in which case the parameter will be set at the beginning of the Routine on each repeat of it. Lastly many parameters can even be set on every frame, allowing them to change constantly on every refresh of the screen.