Calling a website from PsychoPy

If this template helps then use it. If not then just delete and start from scratch.

OS macOS Catalina
PsychoPy version 2021.2.3

What are you trying to achieve?:

I am trying to call a website from within PsychoPy. The idea is to have participants play a computer game for 3 minutes, then return to answer questions about the game (using the slider). In a loop you cycle through 4 repetitions of calling the game, returning to answer questions etc.

I imported webbrowser, and it does open the website, but I can only see it after the experiment is finished.

Alternatively can you run Psychopy as a standalone window that runs in parallel while the player plays the game on another window? That way I could use Psychopy to signal the 3 minute playing epoch by playing start and end sounds (whereupon the player returns to Psychopy to answer the slider questions)

Is the computer game in PsychoPy or another tab?

You can run PsychoPy not in full screen but I think that the only way to get a background PsychoPy experiment to signal 3 minutes would be to play a 3 minute sound file that consists of silence ending on an alarm.

Hi There,

Yes, just to clarify - is the aim to run PsychoPy locally (from standalone) and call a website? As opposed to running a study in the browser, on pavlovia, and calling a website.

If the former you can use this, add a routine with a text component (or anything to be fair!) that lasts 3 minutes, then add a code component with the following:

Begin experiment tab:
import webbrowser

Begin Routine tab:

win.fullscr = False# exist full screen'') # open browser

End routine tab:

win.fullscr = True# bring back to full screen

Hope this helps!


This works brilliantly!!! Thanks so much for the lightning-fast reply and all the best of the season!