'Psychopy, new circle at each iter of loop

just working on an experiment that works as a staircase. i have two circles, the player must RightKey or LeftKey to chose the brightest circle. So i did all of this inside the coder. Now I want to appear a new circle each time the player press a key. Here is a bit of code:

def getcolor():
    color = [360, 1, 1]
    color[0] = random.randint(0, 361)
    return color

def getfirst():
    rand=random.choices([True, False])
    if rand[0]:
        lcolor = getcolor()
        rcolor = lcolor[:]
        rcolor[2] = 0.8000
    else:
        rcolor = getcolor()
        lcolor = rcolor[:]
        lcolor[2] = 0.8000
    return lcolor, rcolor

for thisIncrement in staircase:  # will step through the staircase
    result = getfirst()
    lcolor, rcolor = result
    
    lcircle.draw()
    rcircle.draw()
    event.waitKeys()
    #core.wait(1)  # wait 500ms (use a loop of x frames for more accurate timing)

    # blank screen
    fixation.draw()
    win.flip(clearBuffer=True)

lcircle and rcicle are there on the first iter, but it doesnt reload at each.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source