I have to agree with Tristam here. The decorator approach to event handling seems like a great idea at first, when writing simple demos and one-off toy apps, but it's immensely fragile, and doesn't play well in the context of a larger program. I'm intrigued that Richard says he tends to use decorators more often than the alternatives - I simply can't imagine using them in anything more complicated than a one-file simple program.
Getting back to the quick reference, I don't think the point of such a document is to present alternatives - it's either there to showcase what Pyglet can do for beginners, or to remind people how to do things that they've forgotten about. I'd be inclined to include one syntax or the other, but not both. My preference would be with push_handlers, but I think that including several variations just overcomplicates things, and takes up space which could be used to demonstrate other features. Martin On 12 July 2010 01:20, Tristam MacDonald <[email protected]> wrote: > On Sat, Jul 10, 2010 at 7:39 PM, Richard Jones <[email protected]> wrote: >> I tend to favour the decorator syntax, but I can see your point. > > <offtopic> > I am coming around to the opinion that the decorators are the single > worst part of pyglet's syntax. The cases where you can't use the > decorators (in classes, multiple handlers for the same event) crop up > surprisingly often, and seemingly minor changes to your program can > cause strange errors in event handling when you transition from a case > where decorators work to a case where they don't. > </offtopic> > > Rant aside, your quick-ref looks like a very good resource for > teaching pyglet. Would you be willing to make a copy available on the > pyglet website when you are done with it? > > -- > Tristam MacDonald > http://swiftcoder.wordpress.com/ > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > 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. > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. 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.
