I want to ask about the use of custom events in pygame ..
I experimented a little with pygame, so I know how usual pygame-generated events works ..
My Question
You can compare events with "==". The compared events must be exactly the same with their attirubutes to be equal
Event1=pygame.event.Event(pygame.USEREVENT, attr1='Event1')
Event2=pygame.event.Event(pygame.USEREVENT, attr1='Event2')
Throw events
pygame.event.post(Event1)
pygame.event.post(Event2)
Main loop
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
break
if event== Event1:
print("event1")
elif event == Event2:
print("event2")