Open queueseven opened 7 months ago
Thanks for the report, please test the patch and report here if it is ok https://github.com/pygame-web/platform_wasm/pull/1
I'm afraid it's not that easy, because event
is used as a key for the THREADS
dict, and if it's a pygame.event.Event
instance, this will fail, as this object is not hashable.
The documentation for set_timer
says:
It is also worth mentioning that a particular event type can only be put on a timer once. In other words, there cannot be two timers for the same event type. Setting an event timer for a particular event discards the old one for that event type.
so maybe a good solution would be to use something like that:
if isinstance(event, pygame.event.Event):
cevent = event
tevent = event.type
else:
cevent = pygame.event.Event(int(event))
tevent = int(event)
and then use tevent
as key for THREADS
.
Thanks I will update my PR
In this line the constructor to
pygame.event.Event
is called withevent
, butevent
itself could already be apygame.event.Event
.If that's the case, then the constructor of
pygame.event.Event
will throw aTypeError
: