OS; W7
PsychoPy version 1.84.2
Standard Standalone? Y
Hi All,
I need to pick your brains on that.
I am trying to implement a block manipulation task.
Effectively, the Ps are given a number of blocks, each block having a different pattern on each plane, and they need to replicate the overall pattern shown on a card.
AFAIK, psychopy cannot currently do 3D/stereoscopic stimuli (I may be wrong) let alone rotating them too. So I am going for 2D and drag and drop.
So far so good, but - of course - I have a problem. If a P drags an image and drops it into the matrix in the middle I need the same image to “reappear” in the original position so that I have two identical images; one inside the matrix of white squares in the middle and another one on the side. The reason for that is because the same image may be used more than once. I want to do it that way to avoid having 48 images to the left and right side (8 cubes x 6 planes - just to confuse you a bit more ).
So my question is can I generate an image stimulus on the go i.e. when an image is moved from its original position ?
Below are two screenshots of how it looks like at the moment. First, initial page, second after successful completion. I also attach the exp so far (feel free to use it).
Many thanks in advance
If I understand what you want to achieve, I think the only thing needed is to use the same image content (same file) in two places (i.e., in two ImageStim with different locations). Does that work?
Also, 2D is indeed so much easier to work with than proper 3D. Maybe you could add some dimensionality by using (2D) photographs of 3D tiles, instead of a graphic / top-view
@jeremygray Many thanks for the tip … I do not know why I didn’t think of it before. I just put the same image in a stack of 8 in the same location and that’s done!
Another (but unrelated to the original post) slight problem I face is that when when two images are overlaid and the mouse hovers over it (with left button pressed) then the previous image is selected. I cannot describe it correctly so here is a link to a screencast of what I am talking about.
I know this is because of my code but I cannot think of way to correct it. If you (or someone else) can think of a solution it’ll much appreciated.
within “Each Frame”
mouse1, mouse2, mouse3 = mouse_resp.getPressed()
if (mouse1):
if bl.contains(mouse_resp): # if the image contains the cursor
bl.setPos(mouse_resp.getPos()) # set the image where the cursor is
blTx, blTy = mouse_resp.getPos() # store the x,y coords of where the image is now
elif bl1.contains(mouse_resp): # if the image contains the cursor
bl1.setPos(mouse_resp.getPos()) # set the image where the cursor is
blTx, blTy = mouse_resp.getPos()
elif br.contains(mouse_resp):
br.setPos(mouse_resp.getPos())
brTx, brTy = mouse_resp.getPos()
elif red.contains(mouse_resp):
red.setPos(mouse_resp.getPos())
elif tl.contains(mouse_resp):
tl.setPos(mouse_resp.getPos())
elif tr.contains(mouse_resp):
tr.setPos(mouse_resp.getPos())
elif white.contains(mouse_resp):
white.setPos(mouse_resp.getPos())
\#if the centre of the image is within the coordinates of the "right" square then "Success",
\#allow the press of spacebar which moves to the next trial
if design == 5:
blXTarget = (m1TargetX1 <= blTx <= m1TargetX2)
blYTarget = (m1TargetY1 <= blTy <= m1TargetY2)
brXTarget = (m2TargetX1 <= brTx <= m2TargetX2)
brYTarget = (m2TargetY1 <= brTy <= m2TargetY2)
if blXTarget and blYTarget and brXTarget and brYTarget:
mess = "Success"+"\n"+"Press the spacebar to continue"
if "space" in theseKeys :
continueRoutine = False
else:
mess = ""
from the video it looks like “dragging” is not really working. I think your code needs to handle the condition where you are currently dragging one tile – in that case the mouse should not switch to and pick up other tile. currently the code logic is only about whether the mouse is pressed within the boundary of a tile. So you’ll need more conditions, and need to keep track of the mouse state and what “dragging” a tile means in terms of the mouse position and state.
I am taking your thoughts/suggestions on board (though how I am going to implement them is another matter ) . Many thanks for spending time on this. Much appreciated.
You can easily present stereoscopic stimuli with any experimental software (including PsychoPy) by rendering your stimuli as Top&Bottom images. This way, working with stereoscopic content is no different from presenting any other images. You just need to enable the appropriate setting in the menu of your 3D screen that content is delivered as Top&Bottom images and that it should present it appropriately.
1 Like