[visionegg] sorry to bother you again...

  • From: Jordanna Sprayberry <jdhenry@xxxxxxxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Thu, 29 Jan 2004 15:46:27 -0800

I can't figure out how to define finite go loops inside of a run forever loop. Previously Andrew said I should only be using one presentation object, but I don't seem to be able to get it working. Here is a test program I've written (relevant bits). Does anybody have sample code I can look at?

Problem: when I hit the 'a' key, the presentation changes to displaying the viewport b stimulus, but does not return to the viewport a stimulus when finished.

#####################################################
# design 'handling' of run forever loop
#####################################################

global p

f=open('debug_file.txt','w')
def keydown(event):
        if event.key==pygame.locals.K_q:
                p.parameters.enter_go_loop = 0
                p.parameters.quit = True
        elif event.key==pygame.locals.K_a:
                p.set( go_duration=(5.0,'seconds'),
                              viewports=[viewportb],
                              enter_go_loop=1)

handle_event_callbacks = [(pygame.locals.KEYDOWN,keydown)]


##########################################################
# create presentation object for outside run forever loop
##########################################################
p = Presentation(viewports=[viewporta],handle_event_callbacks = handle_event_callbacks)



############### # run it !!! # ###############

p.run_forever()

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

Other related posts:

  • » [visionegg] sorry to bother you again...