psychopy.org | Reference | Downloads | Github

Help translating PsychoPy Python to JavaScript

Hi, I just realized that I need to change my custom code from python to JS in order to run my experiment properly in Pavlovia.

I have the following codes: (screenshotted, the first two belong to a questionnaire, the last 4 are related to a temporal task -press the space bar for a certain amount of time- )

How should I change it to JS? This should be extremely easy but I’m having a hard time since I don’t code in JS. Could someone help me out? Thanks!

Hi @stefano_arlaud, it looks like you are using a Form component in your task? If so, the Form class (and the button class) are currently in development for online tasks, but you can create your form for online tasks using text stim and slider components.

so you mean I can’t run those tasks online?

You can run tasks online that do not use the Form component. However, the Form component is essentially a series of text and Slider components all drawn together, so you could easily achieve the same thing with text and slider components in a loop. For example:

URL: https://run.pavlovia.org/dvbridges/newq/html/
Files:

newQ.psyexp (7.1 KB) cond.xlsx (7.8 KB)

Another option if you are combining behavioural data with survery data is to redirect your participant at the end of the study to another web-based survey tool.

I get what you mean, I think with the questionnaire I can turn around the problem. However I’m stuck with the temporal task.
Is it possible by means of multiple PsychoPy components to build a routine where:

you should press the spacebar for a certain amount of time and then, once released, go to the new routine (I need to then have saved the amount of time).
I screenshot the routine to make it clearer


Have you any suggestions?

I really thank you for your patience!