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

Re: [pygame] creating user events



sashan wrote:
At the moment I'm creating user events like this :

some_event = pygame.event.Event(pygame.USEREVENT+2)
pygame.event.post(some_event)

Is there a better way?
this is the only way to do it. you may want to create your own variable to represent the event id, in case it ever needs to change. and remember you can pass your own attributes with the event.

MYEVENT = pygame.USEREVENT+2
some_event = pygame.event.Event(MYEVENT, value=10.2)
pygame.event.post(some_event)