PDA

View Full Version : pausing director/timer functions


mikestatic
01-25-2006, 09:48 AM
I am looking for a method to automatically pause a director function (i.e. swapimage) at particular points during the script (to await verbal feedback from participants) and have a keyboard function that unpauses the script and continues to the next event. I have tried the pause command, but I may have been misusing it. I am open to trying a timer event if that is more appropriate. Regardless, I will need to pause and unpause about 40 times throughout the director function; therefore I don't think that I can use multiple swapimage commands attached to different keystrokes as I may not have enough keys.
Below is part of the code I currently use to present the stimuli without a pause between each picture. I want to beable to pause and unpause at the points marked #.

def swapimage1 ():
screen.texture(waitperiod)
viz.waitframe(20)
#
screen.texture(fixation)
viz.waitframe(10)
screen.texture(stim01)
viz.waitframe(5)
#
screen.texture(fixation)
viz.waitframe(10)
screen.texture(stim02)
viz.waitframe(5)
#
screen.texture(fixation)
viz.waitframe(10)
screen.texture(stim03)
viz.waitframe(5)
#
screen.texture(fixation)
viz.waitframe(10)
screen.texture(stim04)
viz.waitframe(5)

Please let me know if I need to clarify any portion of this request. Thank you very much for your help.

farshizzo
01-25-2006, 10:02 AM
Hi,

If you only need to wait for a key press then use the viz.waitkey command. For example, if you wanted to wait for the spacebar to be pressed you would do the following inside your director function:viz.waitkey(' ')

mikestatic
01-25-2006, 10:15 AM
viz.waitkeypress(' ')

Thanks. It is a very easy solution!