Hello!
I have this code through which I’m aiming to show four different images at a time on a window.
from future import division
from psychopy import visual, core, event
import numpy as np
Create a window to draw in
win = visual.Window(monitor=‘testMonitor’, units =‘norm’, screen=0)
instr = visual.TextStim(win,
units=‘norm’, height = 0.1, text=‘press any key to begin’)
im = visual.ImageStim(win, image=‘wolf.jpg’)
mouse = event.Mouse()
Show the instruction
instr.draw()
win.flip()
event.waitKeys()
im_positions= {0:(-0.5, -0.5),
1:(0.5, 0.5),
2:(-0.5, 0.5),
3:(0.5, -0.5)}
show image
#im.draw()
np.random.randint(4)
win.flip()
clicks = []
while True:
for i in range(4):
im.pos = im_positions[i]
im.draw()
buttons = mouse.getPressed()
pos = mouse.getPos()
if np.any(np.array(buttons)):
print(buttons)
print(pos)
if pos[0] < 0.1 and pos[0] > -0.1:
clicks.append(pos)
print(pos)
break
#core.wait(0.1)
win.flip()
win.close()
core.quit()
I’m having a hard time coding the extra three image files: should I name each file as
im1 = visual.ImageStim(win, image=‘wolf.jpg’)
im2 = visual.ImageStim(win, image=‘duck.jpg’) and so forth?
any tips would be super helpful!