Hi all,
I am trying to draw a rotating line (a clock hand). Participants should press the spacebar any time that they want. Then, after 250 ms, a tone starts playing, and finally, after 250 ms, the routine should end. I drew a rotating line and it worked fine.
The problem is that after participants press space, the line stop rotating, but everything else is working as expected. I was wondering if I can do a trick so the line rotates until the end of the trial?
# each frame tab
clock_hand.ori = t *140.23 # one rotation in 2560 ms
clock_screen.draw()
clock_hand.draw()
k = event.getKeys()
if k == ['space']: # if space is pressed
pre_tone= core.Clock ()
pre_tone.reset ()
while pre_tone.getTime() < .250: # wait for 250 ms
clock_hand.ori = t *140.23 # meanwhile do the rotation
clock_screen.draw()
clock_hand.draw()
now = ptb.GetSecs()
tone.play(when=now+0.1) # play the tone for 0.1s
post_tone= core.Clock ()
post_tone.reset ()
while post_tone.getTime () < .250: # wait for 250 ms
clock_hand.ori = t *140.23 # meanwhile do the rotation
clock_screen.draw()
clock_hand.draw()
continueRoutine= False
elif k == ['q']:
core.quit()