Hi! I want to present a stimulus text e.g. “Rest” and below this text I want to have a timer counting down from 60 below this.
To try and do this, I’ve created a csv with numbers counting down from 60, is it easier to also have a csv with “Rest” repeated so I can loop through both and draw them? How would one implement this? Or is there an easier way to do this?
I would appreciate any help or direction, thank you! I’ve looked at other threads, however, these use builder exclusively. The code snippet is below
for j in all_text:
text = Text_stim(win, text = j)
clock.reset()
win.callOnFlip(port.write(trigger_start.encode())
while clock.getTime() < 60:
text.draw()
win.flip()
port.write(trigger_stop.encode())
This code snippet is designed to go directly within the text field of the textstim component - if you are specifying it in code then you can remove the dollar sign and use $rest_text in the text component
Ive got the following code which shows the countdown timer fine but the number stays on “9” and does not move, how do I get it to change every second? Thanks!
countdown.psyexp (5.9 KB)
I really recommend that you just use the code snippet inside a text component and set to update every frame - like this (it will be much easier)
Dear @Becca
Thanks for the suggestion. It seems to work, but it shows every second (eg: 59,999). I need to countdown from 1000 milliseconds to 0. How can I do? Thank you!