[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] event.wait and userevents



I think the problem is the way you are using it. This works fine for me.

pygame.time.set_timer(pygame.USEREVENT, 1000)

while True:
    event = pygame.event.wait()
    if event.type == pygame.QUIT:
        break
    elif event.type == pygame.USEREVENT:
        print 'timer'



Christian Reichlin wrote:
hello,

i made a litte app with pygame. i had troubles with the event loop using pygame.event.wait and userevents, triggered by pygame.time.set_timer(pygame.USEREVENT, 1000)

the following code didn't work. it looks like during pygame.event.wait() userevents aren't processed internally. as long as no other event got triggered, the loop blocked.
   ...
   for event in [ pygame.event.wait() ] + pygame.event.get( ):
       # event handling code