On Mon, Feb 23, 2009 at 11:11 AM, [email protected] < [email protected]> wrote:
> > Hi > I'm thinking of porting some visual psychophysics software I wrote to > pyglet. The main issue is that the users like to think of their > experiments as a linear sequence of events. For example, an experiment > consists of numerous trials, and the user specifies what happens on a > single trial: > > wait for a spacebar press to initiate the trial > show the fixation cross for 100 msecs > show word W at position x,y > wait for a keypress response, or timeout if waiting more than 2000 > msecs > if response was incorrect > give 1000 msecs of error feedback > > The thing that the users would just not get or like is coding update/ > draw routines or event handlers that have to keep track of state, etc > e.g this kind of thing is just a non-starter for them: > if waitingfortrialstart > > elif waitingforresponse > > elif displayingerror > > ..... > > Is there a way I can structure the event loop within pyglet to let > users specify the structure of their experiment in this way? Unlike > standard game uses, in this case polling for events is events is fine, > eg from their perspective there is no problem in using 100% of cpu to > poll for a keypress while a stimulus is on the screen. > > Hope I've been able to explain this -- Thanks for any info/advice > Rob A simple solution would be to implement a stack of functions, each with a condition attached. The main loop checks the condition of the topmost function each iteration of the main loop, and if the condition is true, executes the function and then pops it off the stack. I use a system like this with one stack per entity for AI actions. -- Tristam MacDonald http://swiftcoder.wordpress.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
