OS Mac Catalina 10.15.6
PsychoPy version 2020.2.3
**Standard Standalone? Yes
What are you trying to achieve?:
I am looking to adapt the ‘drag and drop’ demo code (from the demos in builder) but in a way that enables the participant to drag the stimuli to any position along the x axis. They must drag the stimulus over the cue stimulus ( a coin) that appears at multiple locations across the x axis.
The demo requires participant to drop and drag black and white pieces to re-create a black and white pattern by looking at the master grid.
Could I adapt this by making a very large grid that spans the entire width of the screen?
Is it possible to set this up without a grid? especially because my responses require the participant to drag the stimulus to the correct position only (and not create a particular pattern as show in the demo).
What did you try to make it work?:
I started to adapt the drag and drop demo code but in every place where ‘piece’ is used to indicate the stimuli that is drag and dropped- I changed it to my drag and drop stimulus (an image of a net).
Begin experiment
def createNet(net, pos, name):
return visual.ImageStim(win, image=net.image, name=name, size=net.size, pos=pos)
def drawPicked(picked):
for each in picked:
each.draw()
def movePicked(picked, mouse, grabbed):
if grabbed is not None and mouse.isPressedIn(grabbed):
grabbed.pos = mouse.getPos()
return grabbed
else:
for net in picked:
if mouse.isPressedIn(net) and grabbed is None:
``return net
Please see my attached file for the demo for more details of the code element.
What specifically went wrong when you tried that?:
No error message but the experiment will not run. However it does run when I remove the code element and run a version that returns the final mouse position with no drag and drop capability
Files
showCoin.psyexp (19.1 KB) coinConditions.xlsx (8.8 KB)