TomH
March 10, 2020, 1:08pm
1
OS (e.g. Win10): WIN 10
PsychoPy version (e.g. 1.84.x): 3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I am designing an object location task where:
the participant is shown objects in their correct location in an exposure phase (which is done and works fine).
they are then shown the object at the centre of the screen
they then have to drag the object to where the think the object belongs (i.e., where they were shown it previously)
A trial is classed as correct if the object is within 150 pixels of its original location.
What did you try to make it work?:
I’ve tried to figure out the drag and drop demo, which is similar but a bit different so have struggled.
i’ve searched through the forum for any relevant threads and nothing quite covers what i’m stuck on.
still looking on OSF for any similar studies.
Any help greatly appreciated.
Best wishes,
Tom
Hi Tom,
You described what you are trying to do but haven’t actually stated what your issue is.
TomH
March 11, 2020, 8:54am
3
Hi Michael,
Thanks for getting back to me
.
The issue simply is that I don’t know how to do it - I’ve been through lots of resources (past forum threads, psychopy manual,osf framework,repository,drag and drop demos) and still don’t know how I’m supposed to do it.
If someone could show me an example or a template for how to do that would be so helpful.
The builder is great but whenever it comes to putting code components in I get lost.
Best wishes,
Tom
Simple drag and drop is quite straightforward. Simply insert a code component on your routine, and in the “Each frame” tab, put something like:
if mouse.isPressedIn(your_stimulus_name):
your_stimulus_name.pos = mouse.getPos()
I guess you will also want to record the location in the data, so in the “End routine” tab, put something like:
thisExp.addData('response_x', your_stimulus_name.pos[0])
thisExp.addData('response_y', your_stimulus_name.pos[1])
1 Like
TomH
March 12, 2020, 10:36am
5
Awesome Michael, thanks i’ll have a play about with the code you sent.
Best wishes,
Tom