def start_trial(length, height, cols): """ Initiates a new trial, draws stimuli :param length: length of stimuli :param height: height of stimuli :param cols: (color1, color2) of stimuli """ screen.refresh() while True: posX = PgTools.rand_x_coord(length) posY = PgTools.rand_y_coord(height) negX = PgTools.rand_x_coord(length) negY = PgTools.rand_y_coord(height) global posStim global negStim posStim = pg.draw.rect( screen.fg, cols[0], ( posX, posY, length, height, ), ) negStim = pg.draw.rect( screen.fg, cols[1], ( negX, negY, length, height, ), ) if posStim.colliderect(negStim): screen.refresh() continue else: if randShapes: PgTools.rand_shape(screen.fg, (posX, posY,),(length, height), posSeed) PgTools.rand_shape(screen.fg, (negX, negY,),(length, height), negSeed) break PgTools.set_cursor(screen, mid=True)
def start_trial(length, height): """ Initiates a new trial, draws stimulus :param length: length of new stimulus :param height: width of new stimulus """ screen.refresh() global stimulus xCoord = PgTools.rand_x_coord(stimLength) yCoord = PgTools.rand_y_coord(stimHeight) s = pg.Surface((length, height)) s.blit(images[random.randint(0, len(images) - 1)], (0, 0)) # s.blit(test_image, (0, 0)) # use to debug clipart screen.fg.blit(s, (xCoord, yCoord)) stimulus = pg.draw.rect(screen.fg, Color('goldenrod'), (xCoord, yCoord, length, height), 15)
def start_trial(length, height): """ Initiates a new trial, draws stimulus :param length: length of new stimulus :param height: width of new stimulus """ screen.refresh() global stimulus xCoord = PgTools.rand_x_coord(stimLength) yCoord = PgTools.rand_y_coord(stimHeight) stimulus = pg.draw.rect( screen.fg, PgTools.GREEN, (xCoord, yCoord, length, height), ) if randShapes: PgTools.rand_shape(screen.fg, (xCoord, yCoord), (length, height), randInt) PgTools.set_cursor(screen, noPos=True)