psychopy.org | Reference | Downloads | Github

PsychoPy Online Demos

If you have routines or experiments that are likely to be useful to others, please create a post in this thread, editing your post to add new demos so there is one post per creator. Ideally set your demos so they can be tested without consuming a credit (if you don’t have a site license) by adding a final routine that can’t end, disabling save incomplete results and adding a small number of credits.

Please do not discuss the demos in this thread or create more than one post unless you have a large number of demos to share, in which case please use separate posts for separate categories.

If you use PsychoPy code in your work please cite it as follows (APA 7th):
Author(s). (Date of last substantial commit). Title [Computer software]. Pavlovia. URL.
where the URL is either to the experiment page on pavlovia.org or an OSF/Zenodo DOI.

Affect Grid code | try it

Based on Russell, Weiss, and Mendelsohn (1989) but with an even number of scale points. Russell, J. A., Weiss, A., & Mendelsohn, G. A. (1989). Affect grid: A single-item scale of pleasure and arousal. Journal of Personality and Social Psychology, 57, 493–502. The grid is created in code using an array of ShapeStim polygons.

Brookes Template 2020 code | try it | discussion thread

Demonstrations of code_JS, embedding html forms and external videos, and using code components for free text responses.

Change Blindness RSVP code | try it | discussion thread

An experiment created in December 2020 for Sasha Andrade (supervised by Michael Pilling). In this case the polygons for each RSVP stream are set up in one routine and then displayed in a second using AutoDraw manipulations to show and hide each frame.

Demographics code | try it | discussion thread

An embedded html demographics form (online only) using iFrame code shared by @arnon_weinberg. The responses are saved to the data file as expInfo variables, which means that they will appear on every line of the data if the form is placed before the experiment. Use my Form to HTML for Pavlovia web app to convert PsychoPy form csv files to html pages.

Digit Span code | try it

Random digits are presented at a rate of one per second. The first digit cannot be 0 Following digits can be 0 but cannot be the same as the previous digit. If the answer is correct the span is increased for the next trial If the answer is wrong the span is decreased for the next trial. If there are at least two errors at a given span and that represents more than half of the total attempts at that span then the experiment ends, returning a span of one less than the final span attempted.

Free Recall code | try it | discussion thread

Free text response for up to 20 words/phrases with arrow key and mouse interactions both between and within words. The correct answers for the demo are the numbers one to twenty.

Independent Randomisation code | try it

Pre-load one column from a spreadsheet so that the contents can be displayed in an independent random order alongside the contents of another column. This demo also uses shuffle to randomise the location of the target.

Interactive Slider code | try it | discussion thread

This shows a PsychoPy slider object which can be moved using the left and right arrow keys or hovering over the slider with the mouse. Responses are submitted with a mouse click or the return key. The position of the slider is also recorded every 3 frames and presented on the screen in addition to being saved to the console and the data file. The code for using the keyboard may be useful for anyone wanting to detect whether particular keys are currently pressed or not. A custom slider is also included which looks and behaves the same as the standard slider offline and still works online. The custom slider can cope with changes in the numbers of tick points and labels, wrapping the label text accordingly to avoid overlaps.

Moving Cue code | try it | discussion thread

Moves a pulsating circle around the screen like an eye tracker calibration cue. Paths are read from an Excel file but implemented using a TrialHandler in code (which requires a number of edits to work online).

Music Box code | try it | discussion thread

Plays music (Greensleeves) from a spreadsheet containing three columns: Note, Duration and Octave. The quality isn’t great and it sometimes warbles towards the end so suggestions for improvements are welcome.

Music Player code | try it | discussion thread

An interactive version of Music Box which uses the same Greensleeves spreadsheet. Press the letter of the displayed note and it will be played at the start of the next routine with the specified duration, sharp and octave. Press space if you see “_”.

PM Time code | try it | discussion thread

I have been writing prospective memory experiments for students for over 20 years. This one features both event-based and time-based tasks with a clock that appears when the space bar is pressed to allow the participant to check the time. This experiment features my interleaved lists method as detailed in my code snippets page.

Reaction Time code | try it

Three quick reaction time tests (simple keyboard, choice keyboard and simple mouse). Mean RTs are calculated for each type.

ScreenScale code | try it | discussion thread

Use to ask a participant to work out their screen scale relative to a credit card.
Morys-Carter, W. L. (2021, May 18). ScreenScale [Computer software]. Pavlovia. https://doi.org/10.17605/OSF.IO/8FHQK

Self-Paced Reading code | try it | discussion thread

Based on code from my code snippets Google page and using sentences from @Zeinab_Alipour, this demo includes reading times for each word and an editable text box comprehension question. Variants include incremental phrase, central word, moving window and moving word.
Morys-Carter, W. L. & Alipour, Z. (2021, June 2). Self Paced Reading [Computer software]. Pavlovia. https://doi.org/10.17605/OSF.IO/S2FD6.

Scroll Text code | try it | discussion thread

Scroll a text box up and down using arrow keys, mouse on a scroll bar or dragging and dropping the text itself. The code automatically estimates the total length of the text so the scroll bar is updated when the text is moved by other means. Press spacebar to continue appears once the text has been scrolled to the bottom. I use a new jitter method to update otherwise static components to keep them in front of the scrolling text.

VESPR Template 2021 code | try it

Testing some options including PsychoPolyFill

4 Likes
VESPR Demo Interactive Slider
VESPR Demo Free Recall online
Associate slider and text
Change of slider style in Pavlovia
Allowing others to pilot your experiment? (on Pavlovia or other platforms)
Form component not working on Pavlovia (text, scroll and color)
Download Time Before the Experiment Starts
Problem with my rating scale
Quick question on timer/countdown options
Trouble getting typed responses in Pavlovia - textbox or key inputs
Experiment that skips forward and jumps back through blocks
TypeError: Cannot read property 'toString' of null
Dot probe on psychopy builder, how to select a picture randomly from a folder to present on each side of the screen?
RSVP image presentation timing errors
(Solved) Is it possible to use button (like arrow) to navigate thru the trials back and forth
Cedrus Box interact with Slider
Save self-generated data to server
Annoying clicking sounds while using external sound file and running in Pavlovia
Applet for merging multiple .psyexp files
Change opacity of image continuously with slider position
Change opacity of image continuously with slider position
Using paste key 'ctrl+v' on the Textbox response
Synchronizing and loading large resource folder (with videos) online
Using paste key 'ctrl+v' on the Textbox response
Missing header in Form
How to make images displayed randomly?
Fixed distance between visual stimuli regardless of different screen sizes
Typed responses and randomization of questions into psychopy
Sounds not working only for long experiments in Chrome
Insert HTML in Builder
Uploading experiments to Prolific/Amazon MTurk
Problem import excel file in pavlovia
Ways to standardize or record volume on subjects' computers
How to insert a questionnaire in the experiment that presents different kinds of questions?
Experiment on mobile device
Can I make my experiment interactive by Psychopy?
Easy Technique for Getting Typed Responses (Code Provided)
Embedded YouTube video success story
Formatting problem with Form in Pavlovia
Error while trying to launch experiment online
Slider marker does not show in online experiment with keyboard control
Randomization without consecutive critical items
Order Randomization Help
Running code on pavlovia
Unspecified Javascript Error Related to Sounds
Can't sync my experiment from Pavlovia to the Builder
The routine to get typed response does not show up at all and is skipped in Pavlovia
Disable mouse for the silder response and uses keyboard only
Consent for experiment online
Error when running a Form
Self-paced reading using code component
Increasing label size (letter height) of sliders not transferred to use online
Corsi Task - ReferenceError: currBlockName is not defined
Feedback Value Appears NaN
Randomized stimuli in sequential block order
Playing one row from the second spreadsheet after playing two rows of the first spreadsheet and then returning to the first spreadsheet again
Semi-random order to avoid repetition of grouping variable
Property '0' of undefined on second load of same resource
Routine sequence
Textbox does not show a flashing cursor
Change text orientation
Slider problem in builder
Simultaneously randomize two columns in conditions file
Building a keyboard slider that works online

Countdown | code |

The “Words Round” from Channel 4’s Countdown, including a word checker at the end.
(Local only, for now)

My experiments serve as JavaScript tutorials and demos on how to extend PsychoJS with extra features

JavaScript Debugging Tutorials

tutorial_js_syntax_error

Experiment is stuck on “initialising the experiment…” code | try it

tutorial_js_semantic_error

PsychoJS shows a dialog with an error message. code | try it

tutorial_js_network_error

PsychoJS shows a dialog with “unknown resource” message. code | try it

tutorial_js_console_log

Get additional info about what is happening in the code of your experiment. code | try it

tutorial_js_expose_psychojs

Find out how your to expose PsychoJS objects to the web browser, so that you can access them via the browser console, and try things out in order to see what works (or not). code | try it

assignment_stroop

An exercise, featuring an experiment with a syntax, semantic, and network error. code | try it

Demos that extend PsychoJS

demo_eye_tracking2

Eye-tracking via a webcam. code | try it | discussion thread 1 | discussion thread 2

mouseview_demo

Mouse-tracking. code | try it

demo_gyroscope

Tells the orientation of a hand-held device. code | try it

demo_keyup

Log the duration of a keypress. code | try it | discussion thread

demo_multikey

Register multiple keys being up or down at the same time. code | try it

demo_dynamic_loops

A loop that is set up via code instead of reading directly from a conditions file. code | try it

demo_dynamic_allowedkeys

Illustrates how to have a Keyboard Component in PsychoJS listen to a set of keys specified in a conditions file. code | try it

demo_chaining

How to daisy chain Pavlovia with another website (like Prolific or Qualtrics). code | try it

demo_embed_html

Embed an HTML page or a form.io form into a PsychoJS experiment. code | try it

demo_polyfill

JS workarounds of @wakecarter’s crib-sheet, upgraded and bundled up in a single JavaScript file code | try it

2 Likes

I’ve decided that this thread is a good place to keep links to my Pavlovia resources as well as my demos.

PsychoPy Primer slides

Introductory Google slides using PsychoPy version 1.90.3

PsychoPy Python to JavaScript Crib Sheet 2021 | 2020 | discussion thread

Extensive tips and notes on how to make the most of Auto translate code components in PsychoPy.

Code Component Snippets link | discussion thread

Examples of Python / JavaScript code based solutions.

Form to HTML for Pavlovia link | discussion thread

Convert csv files created for the PsychoPy form component into html suitable for embedding.

Participant IDs for Pavlovia link | discussion thread

Assign consecutive participant numbers to your participants by recruiting using a link to this page instead of directly to your experiment. Values for id, session and researcher can be passed through unchanged, or consecutive values for session can be generated if you send a value for participant. No data is stored about participants other than the experiment folder, the time and, if applicable, the incoming participant id.

VESPR Study Portal link | discussion thread

Allows researchers to host study information, assign consecutive participant numbers, allocate evenly to groups (compensating for non-finishers) and anonymously withdraw consent or submit their email (e.g. for entry into a prize draw).

Using Slider Position to Change Opacity of Image code | try it | discussion thread

Changes the opacity of an image depending on current slider position: a light bulb lighting up depending on Aha! rating. In the demo, this effect is achieved by making an underlying version of the same image with a different color more or less visible.

2 Likes

Getting Typed Responses Locally or Online (Pavlovia) video link | discussion thread

Video demonstration and code (in video link) for getting typed responses from participants. Works locally and online.
2 Likes

Some tools for auditory scientists:

Headphone check test code | try it | paper
an online headphone check test using dichotic pitch stimuli to ensure that your participants use heaphones rather than speakers.

Sound volume setting procedure code | try it | paper
A sound level meter helps you and your participants to reliably control stimulus amplitude in online testing.

Adaptive Staircase Thresholding Procedure code | try it | paper
A plugin to do staircase online

1 Like

Simple “Video Player”-Controls Implementation for MovieStim (Online and Offline)
Utilizing the Likert-Scale-Component to mimic a video progress-bar and polygons to match “Play”- and “Stop”-Buttons. Try it | Code | Discussion

1 Like

PsychoPy Merger try it | discussion thread

An R-based online applet to easily merge mutiple .psyexp files into a single one.

PavloviaSwitch try it | github | discussion thread

An R-based online applet to implement controlled/deterministic counterbalancing for pavlovia experiments (i.e., a VESPR study portal alternative). try it only is for checking it out. If you really want to use it, implement it on your own server.

1 Like

Hi @ajus, I couldn’t get the link for this to work - is it working for you?

Thanks for the heads up. I’ve fixed @ajus 's links.

2 Likes