Setting stimuli to same location using "vertices" and "pos"

Hi There,

I am trying to set the location of a .png image to be in the same location on the y axis as a polygon created using ShapeStim.

I set the location of the polygon using the “vertices” attribute (because I wish to dynamically change the size of the stimulus). I set the location of the image using the “pos” attribute and try to set it to the exact same location as the polygon (although offset to the right) by indexing the vertices list.

When I present the two they do not appear in the same location. Both of the stimuli are in the same units (cm).

Any advice would be much appreciated! Hopefully I am missing something obvious!

Code and associated image below.

from psychopy import visual, event
import os

win = visual.Window(size=(1000, 900),
    fullscr=False, screen=0, 
    winType='pyglet', allowGUI=False, allowStencil=False,
    monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
    blendMode='avg', useFBO=True)

vert = [(-1,-9), (-1,-8.8), 
        (1,-8.8), (1,-9)]

fillBar= visual.ShapeStim(win, fillColor='skyblue', lineWidth=0, opacity=1, size=.7, units='cm', vertices=vert)

Spaceship=visual.ImageStim(win, image='Spaceship.png', pos=(4, vert[2][1]), units='cm')



Hi Guys,

The solution was embarrassingly simple… The “fillBar” variable was scaled down " size=.7".

1 Like