[visionegg] Re: using pygame.time.delay
- From: Darren Weber <darrenleeweber@xxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Tue, 22 Mar 2005 12:44:37 -0800
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).
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
- Follow-Ups:
- [visionegg] Re: using pygame.time.delay
- From: Andrew Straw
- References:
- [visionegg] using pygame.time.delay
- From: Darren Weber
- [visionegg] Re: using pygame.time.delay
- From: Mark Halko
Other related posts:
- » [visionegg] using pygame.time.delay
- » [visionegg] Re: using pygame.time.delay
- » [visionegg] Re: using pygame.time.delay
- » [visionegg] Re: using pygame.time.delay
- » [visionegg] Re: using pygame.time.delay
- » [visionegg] Re: using pygame.time.delay
- [visionegg] Re: using pygame.time.delay
- From: Andrew Straw
- [visionegg] using pygame.time.delay
- From: Darren Weber
- [visionegg] Re: using pygame.time.delay
- From: Mark Halko