I have a task in which mouse clicked in a circle draws a cross and stores the location of the click. This worked well in builder using following code I modified from someone else code. There is a custom function called makeCross involved.
Begin Experiment
def makeCross(pos):
cross = visual.ShapeStim(win, pos=pos, depth=-2, vertices='cross', size=(0.05,0.05), lineColor=[-0.8, -0.8, 1], fillColor=[-0.8, -0.8, 1])
cross.setAutoDraw(True)
return cross
Begin Routine
crosses = []
Each Frame
if mouse1.isPressedIn(LocCircleBig,buttons=[0]):
crosses.append(makeCross(mouse1.getPos()))
End Routine
for across in crosses:
across.setAutoDraw(False)
When I tried the task in Pavlovia online it did not work. Some discussions in discourse mentioned that .isPressedin not available in online which is disappointing. So tried following instead in the each frame section:
if (LocCircleBig.contains(mouse1) && mouse1.getPressed()[0] === 1 ){
crosses.append(makeCross(mouse1.getPos()));
}
This one did not work both in builder and online. In online I got the error attached as photo.! Any help would be very appreciated. Thanks!!