26 Components and their properties
In this chapter, we will have a closer look at three key PsychoPy components and their properties: the Text, the Image and the Keyboard component.
26.1 The Text component
Figures 26.1 to 26.4 show the basic, layout, appearance and formatting properties, respectively, of our Text component in the routine trial
.1
Most of the properties are probably self-explanatory. A few comments though:
- Letter height in our example is 0.15. Without looking at the units used, you don’t know what 0.15 refers to. Information about the unit can be found on the Layout tab. In our example, it says
Spatial Units: height
. This means that the size of the letters will be approximately2 15% of the screen height. - The position is
(0, 0)
. In PsychoPy, these are the x and y coordinates for the centre of the screen. You can learn more about this topic on this PsychoPy help page about units and using this interactive app illustrating PsychoPy units. - We’ll cover the exact meaning of
$stim
next week. Very briefly, together with the setting “set every repeat”, it means that the stimulus will be updated from one trial to the next.3
26.2 The Image component
Figures 26.5 and 26.6 show the most relevant properties of our Image component in the routine instruction
.4
Again, a few comments:
- “Image” refers to a file name on your computer. In our example, this file is called
letter_flanker_instruct.png
. The image file must be located in the same directory as the experiment itself (otherwise, it would be necessary to specify the path to the image). - The size of the image on the screen will be 1280 x 960 pixels (see “Size” and “Spatial Units”).
- Using the “Orientation” property, images can be rotated.
Note that leaving the size field empty will display the image in its original size in pixels.5
26.3 The Keyboard component
Figures 26.7 and 26.8 show the most relevant properties of our Keyboard component in the routine trial
.
The properties of the Keyboard component deserve some more detailed comments:
Force end of Routine: If this is ticked and the participant presses one of the allowed keys, the trial will end.
Allowed keys: These are the keys that will be registered by PsychoPy. If a non-allowed key is pressed, PsychoPy will not know about this event. To allow all keys on the keyboard, leave the “Allowed keys” field empty.
Store: The default choice for storing responses is “last key”. However, “first key” might be a better choice (if a response is incorrect, you will store the incorrect key and thus know that the response was incorrect). Note, however, that if you choose “Force end of Routine”, the result for both settings will be the same as the first response will end the trial and the first key will therefore also be the last key.
Store correct: If ticked, PsychoPy will store whether or not the answer on a given trial was correct.
Correct answer: Of course, PsychoPy cannot know what the correct answer on a given trial is. Therefore, you must supply PsychoPy with this information. $corrAns
makes PsychoPy look for a column with that name in an input file you provide PsychoPy with (more about this next week).
For the remaining properties, simply leave the default values.
Usually, you will not need the other two tabs that are not shown here. Feel free to have a look at them though.↩︎
Height will vary for individual letters. E.g., an “a” won’t be as high as a “d”.↩︎
For comparison purposes, have a look at the Text component from the routine
taskBegin
. This has text that is set to “constant”.↩︎Again, we won’t need the other tabs.↩︎
This does not work when running an experiment online with Pavlovia though.↩︎