Hello! This is related to a Generating Shapes on top of Shapes using Mouse, but I felt I changed the script enough to make a new post. I cut up my larger script to just have the parts that are relevant to post here, and you’re welcome to look at the abridged script/try running it if you would like to download:
ShapePosSetScriptExample.py (3.2 KB)
Anyways, I am still struggling to get the Gabors to appear in replacement of the rectangles in this script. Here is the most relevant code:
all_pos = [pos_0_0_0, pos_0_0_1, pos_0_0_2, pos_0_1_0, pos_0_1_1, pos_0_1_2, pos_0_1_3, pos_0_2_0, pos_0_2_1, pos_0_2_2,
pos_1_0_0, pos_1_0_1, pos_1_0_2, pos_1_1_0, pos_1_1_1, pos_1_1_2, pos_1_1_3, pos_1_2_0, pos_1_2_1, pos_1_2_2,
pos_3_0_0, pos_3_0_1, pos_3_0_2, pos_3_0_3]
#========================================================================================#
# RECTANGLES & GABORS
rect = visual.Rect(win, width = 50, height = 50, units = 'pix', lineWidth = 5, lineColor = 'black', opacity = .2, autoDraw = False)
gabor = visual.GratingStim(win, tex = 'sin', mask = 'gauss', texRes=256, units = 'pix', opacity = 1,
size = 60, sf = .13, ori = 0, contrast = 1, name = 'gabor1')
#========================================================================================#
for i in range(0, 10):
rects = []
for p in all_pos:
rect.pos = p
rects.append(rect)
rect.draw()
win.flip(); paused = True
while paused:
pressed_pos = []
for r in rects:
if mouse.isPressedIn(r):
r_pos = r.pos; print(r_pos)
gabor.setPos(r_pos)
gabor.draw()
if kb.getKeys('space'):
paused = False
win.flip()
I would greatly appreciate any suggestions to get multiple shapes to appear after the rectangles disappear! Thank you all so much!!