Hi there,
I’m trying to make an image move a certain number of pixels up the screen with every repetition through the loop.
The output shows that the y value of imgm.pos is increasing, but the image does not actually move.
Where am I going wrong?
output:
[ 0. -200.]
[ 0. -100.]
[0. 0.]
from psychopy import visual, event
win = visual.Window(
size=[1500, 1000],
units="pix",
color="white")
imgm = visual.ImageStim(
win=win,
image="monkey.png",
units="pix")
imgm.pos = [0,-300]
# Number of repetitions
epoch = 3
imgm.draw()
win.flip()
for e in range(epoch):
event.waitKeys()
imgm.pos[1] = imgm.pos[1]+100
imgm.draw()
win.flip()
print(imgm.pos)
Cheers!
EDIT: Solved by replacing: imgm.pos[1] = imgm.pos[1]+100 with imgm.pos = [0,imgm.pos[1]+100]. Seems like you need to repeat the x value.