Chapter 18 Miscellenea

18.1 Colour picker

Please note that the colour picker is currently broken. It works under a few specific conditions, but it is very likely that PsychoPy will crash if you use it. Use named colours instead (see Section 11.5.1).

18.2 PsychoPy processes components from top to bottom

Within a routine, PsychoPy processes components from top to bottom. If you would like to draw a star32 on top of a square, the square needs to come first, followed by the star:

18.3 Skipping routines

Sometimes you might want to not present a routine. In PsychoPy, this can be done by using continueRoutine in a code component. For example, you might want to present “Too slow!” feedback only if participants took more than 1.5 s to respond. This can be achieved with a feedback routine that has the following code component in the “Begin routine” tab:

if response.rt > 1.5:  # if the response was slower than 1.5 s
    continueRoutine = True  # present the feedback routine
else:
    continueRoutine = False  # do not present the feedback routine

Below the code component, the feedback routine would also need a Text component that displays the text “Too slow!” if the routine is presented. This text could be set to constant as it never changes.

18.4 Copying and pasting routines and components

In Section 11.2, we briefly mentioned that the “Experiment” menu in the menu bar gives you the option to copy and paste routines:

To copy a routine, click on the routine’s tab (if it is not already selected), then click on “Experiment” and “Copy Routine”. Finally, click on “Experiment” and “Paste Routine”.

It is also possible to copy components. To copy a component, right-click on the component and then click on “copy”. Then click on the routine into which the component should be inserted, and click on “Experiment” and “Paste Component”.

The way to copy and paste routines and components across experiments is to open two Builder windows. Here is how to do this:

  • Open the first experiment as usual.
  • Then click on File → New to open a second Builder window.
  • Then click on File → Open to open your other experiment in the second Builder window.

Please make sure to follow these exact steps! Under Windows, copying/pasting routines will not work if you do not follow these steps. That is, it will not work if you open the second experiment by double-clicking on the .psyexp file in the File Explorer. You must use File → Open.

18.5 PsychoPy demos

PsychoPy comes with a number of demos included. To see the demos, you need to click on “Demos” in the menu bar and then on “Unpack demos”. Next, you need to choose a location on your computer where the demos should be unpacked (this will create a new folder “PsychoPy3 Demos”). If you now click on “Demos” in the menu bar again, a list of demos will be displayed:

A useful demo is the “keyNameFinder” (in “Understanding PsychoPy”). It displays key names on the screen. If you would like to use a particular key in your input file, but you’re not sure what its name is, run this demo.

The demo “spatialUnits” (also in “Understanding PsychoPy”) is helpful for understanding PsychoPy’s spatial units (height, norm, etc.).

18.6 Lab 7 Padlet

Made with Padlet

  1. You can draw simple geometrical shapes in PsychoPy using the Polygon component under “Stimuli”.↩︎