| Reference | Downloads | Github

Getting the start and end timing for a brush component

Hi everyone,

I am new to Psychopy and Pavlovia and I am currently working on an experiment to work online with Pavlovia. I just need a couple more details to add to the experiment. I have provided some details below.

OS Win10
PsychoPy versionv2020.2.4
Standard Standalone

For one if my tasks I ask participants to connect a seires of circles in order using the brush component.

What I want to know is whether I can time how long the brush is used for?

Within my output I can see that brush start time is recorded, but because I don’t set an end duration (this will be detrmined by how long it takes the participant to connect all the circles) the end time is blank.

I was wondering is it possible to use a code component within builder to get the start and end time for this particular component, and if so what would be recommended?

Looking on previous discourse posts it seemed getting a time for a particular component was not possible, but I was wondering if there had been any updates since then.

Any advice would be very much appreciated!


If you have “Save onset/offset times” ticked in the Data tab for the Brush component, then it should save when the component stopped. However, when I test this it does appear to be None, so I’ll see what’s going on there.

You can force it to record a stop time by adding a Code component with this in the End Rouine tab:

thisExp.addData('myBrush.stopped', t)

(with myBrush being whatever you called your Brush component)

1 Like

Hi @TParsons,

Thank you so much for your swift reply and suggestion! This appeared to work and gave me an end time which appeared in the cell below “none” in the brush stopped column in the excel output when i run it from my desktop.

I have yet to try it on Pavlovia but I know there can be some issues with the translation from Py to JS.

I’m having another problem now, in that code which previously worked with Pavlovia no longer does. I am using another code component to reset the brush after a routine, so they can use the brush with a fresh start on another routine.

In the end routine tab i have:

Works just fine in the builder, however, when I test in Pavlovia i get the following error:

TypeError: brush.reset is not a function

If you have any ideas of how I can fix this that would be great.

However, I am happy to open a new discussion in case someone else might be having the same problem in the future.

Thanks again for your help!