Hello list, I have another minor gripe to report. Building my general input decorator pattern [0] was fun, but as I started using it, I noticed that ev.__dict__ doesn't add the type of the event to the dictionary. Incidentally, though, that is the most significant designator for event filters. So I just build a complete dictionary using that 3.5 syntax again [1], which is awkward. Attached is a patch which would just represent all of the event's data in the resulting dict.
cheers! mar77i [0] https://github.com/mar77i/pygametower/blob/master/util.py#L25 [1] https://github.com/mar77i/pygametower/blob/master/tower.py#L77
From ff1960affaea9ebfe6303e5f7ffc7b6b0241f6f9 Mon Sep 17 00:00:00 2001 From: mar77i <mar...@mar77i.ch> Date: Thu, 18 Aug 2016 14:08:24 +0200 Subject: [PATCH] add event type to pygame.Event.{dict,__dict__} objects --- src/event.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/event.c b/src/event.c index eb3d8e7..0854312 100644 --- a/src/event.c +++ b/src/event.c @@ -259,6 +259,7 @@ dict_from_event (SDL_Event* event) if (!(dict = PyDict_New ())) return NULL; + insobj (dict, "type", PyInt_FromLong (event->type)); switch (event->type) { case SDL_ACTIVEEVENT: -- 2.9.3