[visionegg] Re: using pygame.time.delay

Darren Weber wrote:

Thanks guys, that makes sense; pygame.time.delay() does get in the way
of event handling. I found that pygame.time.get_ticks() will keep
track of time (so long as pygame.init() precedes the call).



Do you find it to be more accurate that VisionEgg.time_func()? (This is just time.time() or time.clock() depending whether your system is Windows.)


Cheers!
Andrew


On Tue, 22 Mar 2005 15:24:12 -0500, Mark Halko <mhalko@xxxxxx> wrote:


Darren -
Another way to do this is to set up a controller, using the
presentation structure.

for example if you have:
trial_start_time = 0.
def my_controller(t):
       if t-trial_start_time <= my_stimulus time:
               stimulus.parameters.on = True  #We turned this off during 
intertrial
time
               #do something to put stimulus on screen here
       elif t-trial_start_time <= my_stimulus_time + my_intertrial_time :
               #set stimulus to something blank
               stimulus.parameters.on = False #For example
       elif t-trial_start_time > my_stimulus_time + my_intertrial_time:
               trial_start_time = t

p.add_controller(None,None,FunctionController(during_go_func=my_controll
er))

This way you can add a controller to handle keypresses, without writing
your own control loop.

Mark

On Mar 22, 2005, at 2:05 PM, Darren Weber wrote:



Hi,

I've got a series of visual images to present, each has a defined
duration.  If each stimulus is presented in a for loop, I've found
that the duration of the stimulus can be handled by pygame.time.delay.
However, I wonder if this has any implications for event handling?
Does anyone using the visionegg know if this would be a problem?  That
is, can pygame event handling work during pygame.time.delay?

If pygame.time.delay is problematic, how would you control the
stimulus duration?  Do you need to setup a while loop that continues
to display a stimulus, checking for events and finally exits after a
certain time from onset?  What is the best way to implement the
timing?  Would you use pygame modules or something in the visionegg
itself?

Best, Darren
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html



======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html



======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html




--
Andrew D. Straw  Post-doctoral scholar
,-.              Dickinson Lab
\_/              California Institute of Technology
8||}             Mailcode 138-78
/ \              Pasadena CA 91125, USA
`-^
                email:  astraw@xxxxxxxxxxx
                 office: +1 626 395 4396


====================================== The Vision Egg mailing list Archives: http://www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html

Other related posts: