| Reference | Downloads | Github

Start, pause, and restart timer


Dear all,

I’m programming and experiment in which the participant can move a circle through a 20 x 10 grid and I’d need to create a timer or clock that counts the total amount of time the participant left the circle in a given position. E.g., While the circle is at the A position the timer is counting, if it leaves A1 the timer is paused and when it is back to A1 the timer restarts and so on, so I’d have the total amount of time spent at A1 during that trial.

Is that a code or resource in psychopy I could use to do that?

Best regards,



You can reset a Clock or add to its start value, but once created, they are always ticking. So you need to store snapshots of time values in a variable and add to them as required. e.g. something like this:

  • initialise some total_time variable to 0
  • Loop:
    • reset a Clock when entering A1
    • getTime() from that clock when leaving A1 and add the result to total_time


Thanks so much, Michael.