Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Looping through a block for a fixed amount of time rather than cycles


I'd like to have a block loop continuously for 60 seconds (rather than a fixed number of iterations) during which a participant may make any number of responses.

I see that the clock function may be the way to achieve this, but am unsure where and how exactly to apply it. Would I want to create an inline script ahead of the block_loop and use the clock function? Or perhaps modify the block_loop code directly using the clock function? Perhaps there is a simpler way to achieve this?

Thanks in advance!


  • edited March 24

    Hi Ghazit,

    Try an inline_script.

    Basically, you can run a while loop for 60 seconds and present all your stimuli inside that loop. E.g.

    start_time = clock.time()
    while clock.time()-start_time< 60000:
        print(clock.time() -start_time)
        # sleep for  half a second

    Does this help?


Sign In or Register to comment.