This is a bit cumbersome to use (since I don't know why pygame.NUMEVENTS is limited to 32) but will work.
ZOG_UP = pg.event.custom_type() ZOG_DOWN = pg.event.custom_type() pg.event.post(pg.Event(ZOG_DOWN, msg='hello'))
for e in pg.event.get():
if e.type == ZOG_UP:
print('zog goes up!')
CUSTOM_TYPE = pygame.USEREVENT
But there is a strange thing: using mixer.music, mixer.Channel or pygame.time.set_timer() objects. They provide an set_endevent() method, but only can take an integer (which is almost useless with the NUMEVENTS limit). I would have expected to be able to set a custom event there too because that would solve it the same way as with normal events.
Especially when using a timer you normally want many timers bound to different ids. If pygame would provide that built-in this would really be good (hmm, maybe there should be an additional module for this like for sprites).