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

Re: [pygame] creating user events



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)
Since you pushed me to work with events a few weeks back I've found them very handy. I keep my events for a program in a single file so that they are easy to keep track of. I found that it was too easy to accidently use the same USEREVENT+n identifier for more than one event if they weren't all in one place.


--
"When Government fears the people, it's liberty. When people fear the
Government, it's tyranny." -- Benjamin Franklin

Michael <mogmios@mlug.missouri.edu>
http://kavlon.org