Brush Respose Data

OS Mac OS Sierra 10.12.6
PsychoPy3 Experiment Builder v2021.1.2
Python 3.6.8

What are you trying to achieve?:
Trying to give a sound stimuli and take a response with brush tool

What did you try to make it work?:
Trying to find a solution on this forum , tried to understand if I need to convert any data which is not in an image format to an image but also can not find an answer to that, also converted it to a python file and tried to read to find something about saving that data but could not understand by that way eigther…

What specifically went wrong when you tried that?:
The experiment works but Can not see any brush response data saved anywhere

6.3845 WARNING Monitor specification not found. Creating a temporary one…
2021-03-15 23:39:37.951 python[5853:79969] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/b3/s7y853057yzbys5whx9gvyyr0000gn/T/org.opensciencetools.psychopy.savedState

Experiment ended.

this appears on the console

I did search the path on the error and there are two .data and one .plist files but still can not find a solution about how to see brush component saved data

The Brush component is a tricky one as the data you’re likely to want is very much dependent on your experiment design. During the experiment, you can access the position of the Brush via:


to answer the question “is the Brush currently on this image/shape component?” you would do this:


or get an array of all positions the brush has drawn in via:


and all of these you could use trials.addData to save them to the datafile.

but if you wanted to actually see the response, the best way is to capture the window as an image at the end of the routine:

1 Like

Hi, I try to save the png images of the result. But it continues showing that the win variable is not found. Do you know how can I solve it? Apprecitative of your time!

What tab in the :code: Code component did you put the code in? If win is not defined I’d guess it’s that the code is being executed too early

HI, I just put win.saveMovieFrames(‘data/myFilename.png’) in the code component in each frame. I am wondering what kind of other actions do I need to include before using this function? Thank you so much!

It’s very strange for win not to exist by the time the each frame code is executed, could you share your psyexp file?

Yes! Here is my experiment:
drawing1.psyexp (62.1 KB)
I put the win function in the line_drawing_task rountine.

Are you running this locally? Your :code: Code component has some JavaScript in the Python box:


should be



keys = psychoJS.eventManager.getKeys()

should be


I’m not sure why the specific error you’re getting is that win doesn’t exist, but when running locally psychoJS certainly shouldn’t exist so that might expplain why it’s erroring.

Also I’d advise against saving the screen each frame - you’ll end up just overwriting the same image over and over which will slow down your experiment. If you only want the window at the end of the routine, it’s best to have the screenshot saving in the End Routine tab

Sorry for the late response and thank you so much for your reply and help! Actually, I have run it online. Should it be the reason why the win does not work? The reason I saved each frame is that I want to save the response of each picture of participants’ drawing.

To save each drawing I think you still want it to run at the end of the routine rather than each frame - as this will save after each repeat of the routine.

win not existing online makes sense! In PsychoJS it’s not called win, it’s called psychoJS.window

Okay. I will trouble shoot with it more later. Thank you so much for your suggestions!