Chapter 20 PsychoPy basics

This week we’ll start to create our own experiments. If you have completed simple/choice reaction time task, the flanker tasks or the repetition priming task for PSGY1002, note that all of these tasks were created with PsychoPy, a piece of software developed by Jon Peirce here at the University of Nottingham. You will be using this software to create your own experiments.

This week’s lab will be an introduction to PsychoPy. In the lab, we will briefly demonstrate how to use PsychoPy. You will then have the opportunity to complete some PsychoPy exercises. We would highly recommend that you read Chapters 20 to 22 in the HHG before the lab class. This will make it easier for you to follow along in the lab class and to complete the exercises. There will be a lot of new information in these chapters. Take your time when working through them! Start with Chapter 20. After a short break, work through Chapter 21. After a longer break or a good night’s sleep, engage with Chapter 22.

With PsychoPy, the most important thing will be that you try things out. Therefore, there will be a number of exercises for you to complete in the lab class. Remember that you cannot break PsychoPy13, so nothing can go wrong! As always, we will be there to support you should you encounter any problems. To solve issues with PsychoPy, it might be helpful to bring your laptop to the lab session or the help desk. If you post on the forum, please try to describe your issue in as much detail as possible. Describe what you were trying to achieve and what went wrong. State what you already tried to solve the issue. Add screenshots to illustrate the issue.

20.1 Install PsychoPy

PsychoPy is free and open source software. It is available for Windows, macOS and Linux. You can download PsychoPy from this page. I would highly recommend to install the current standalone version on your own computer. At the time of writing, this is version 2022.2.4.

If you are running macOS, please note that in order to install PsychoPy you have to drag and drop the PsychoPy icon onto the Applications folder when this window comes up:

If you don’t do this, PsychoPy will not be installed properly!

Alternatives to installing PsychoPy on your own computer

If for some reason you cannot install PsychoPy on your computer (the most common reason being that you own a Chromebook), you can opt for one of the alternatives below. These should be considered fallback solutions, as running PsychoPy on your own machine is definitely the best option.

Loan a laptop

You can loan a laptop for a limited amount of time from the University’s Laptop Loan and Repair Service.

Use the computer rooms in the School of Psychology

All computers in A5, A6, A20 and A21 have PsychoPy installed. When these rooms are not being used for teaching, you can work there.

20.2 Download and unzip a flanker experiment

Once installed, open the PsychoPy app and make sure the Builder window is in the foreground:

Please use the link below to download a letter flanker task from Moodle. We would encourage you to open the experiment in PsychoPy and to compare what you read in the following sections with what you see in PsychoPy.

The file you download is a .zip file. You must unzip the .zip file after downloading it.

  • On a Mac, simply double-click on the .zip file. After unzipping, you should see a regular folder.
  • On Windows, in the File Explorer window, you must right-click on the .zip file and select Extract All.... Otherwise, PsychoPy will not be able to run the experiment.
    • If you double-click on a .zip in File Explorer, Windows will let you “look into” the .zip file, but it is not really unzipped!
    • If unzipping using Windows’ own File Explorer does not work, you could give Express Zip or 7-Zip a try.

While we’re at it: The Windows File Explorer has an extremely annoying default setting (and in fact one that is a security risk): It hides file name extensions. Please do make sure to display these by clicking on View and then on File name extensions:

Once you have unzipped the .zip file, open the folder that was created when you unzipped the file. In that folder, you should be seeing something similar to this (the exact display will of course vary depending on your operating system and settings):

Input files will be explained in more detail in a later chapter. How the instruction picture is used is further explained in Section 22.2. The .psyexp file is the PsychoPy experiment. All three of these files must be present in the same folder for the flanker experiment to run successfully.

20.3 Open an experiment

There are at least four different ways to open PsychoPy experiment files:

  1. Drag and drop the .psyexp file onto the Builder window.
  2. Open PsychoPy → click on the Folder icon in the Builder window toolbar → navigate to the experiment → Open.
  3. In the Finder, right-click on the .psyexp file → Open with → Applications → PsychoPy.14
  4. Double-click on the .psyexp file.

For the fourth approach to work under macOS, however, you first need to tell macOS that it should open .psyexp files using PsychoPy. Here is how to do this (if you follow these steps exactly, you will need to do this only once):

  1. Right-click on the .psyexp file → Get Info → Open with → Choose… → PsychoPy.
  2. You must then make sure to click on “Change all” and “OK” to confirm.

Depending on your operating system and hardware, PsychoPy can take a while to open (potentially up to a minute or so).

20.4 Run an experiment

The simplest way to run an experiment is by clicking on the Run icon:

If you’re running macOS and nothing happens when you try to run an experiment, this is likely due to your security settings. To allow PsychoPy to run experiments, you need to make the following changes:

  • Open System Preferences.
  • Click on “Security & Privacy” and on the tab “Privacy”.
    • Click on “Input Monitoring”.
      • If PsychoPy is already listed, just tick the box next to “PsychoPy”.
      • If it is not listed, click on the plus symbol, navigate to your Applications folder and add PsychoPy.
    • Click on “Accessibility”.
      • If PsychoPy is already listed, just tick the box next to “PsychoPy”.
      • If it is not listed, click on the plus symbol, navigate to your Applications folder and add PsychoPy.
  • You might need to click on the lock in the lower left of the window to be able make these changes.

20.5 Quit an experiment

You can press the Escape key at any time to quit a running experiment. If you are running macOS and pressing Escape has no effect, try Cmd + Alt + Escape.

20.6 Save an experiment

To save an experiment, click on the Save icon or the Save as icon in the toolbar.

Alternatively, you can press Cmd + S (macOS) or Ctrl + S (Windows).


  1. And even if you did: You could simply download and install it again!↩︎

  2. I assume there is some Windows equivalent for this.↩︎