Hi everyone!
This is my first time here so I apologize in advance if I break some rules.
I've been using pyglet for a while and I've found the EventDispatcher's
push_handlers() and pop_handlers() implementation very inflexible. Very
often I want to add handlers between others in the stack, and likewise
remove some in the middle of the stack. One particular use-case is for
example having sprites or other game objects which need to receive events
but are created and deleted during the lifetime of the game, but there are
many others (scene management is another) which can benefit greatly from
this.
The change is as simple as going from:
def push_handlers(self, *args, **kwargs):
to
def push_handlers(self, index, *args, **kwargs):
and similarly for pop_handlers(). I realize as an API change this may be
unfavorable, in which case new method names can be made (e.g.
push_handlers_at()). This is a very small change (Only 4 lines need to be
changed, or slightly more added with the new method name implementation)
but a huge increase in flexibility in pyglet's event system.
What are everyone's thoughts on this matter?
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/pyglet-users/-/FxAHxUglx4QJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en.