0

I would like to start using Pyglet to start creating some GUI interfaces with Python, using what I've learned so far. I'm no expert, in fact I probably know just enough to be dangerous. In looking at the documentation I understand everything so far except ....

Mouse events are handled in a similar way:

from pyglet.window import mouse

@window.event
def on_mouse_press(x, y, button, modifiers):
    if button == mouse.LEFT:
        print 'The left mouse button was pressed.'

What exactly is the @window.event doing specifically the @. I've written event handlers before, so I understand that concept, but I'm at a loss. Based on some searching, both here and on google, I think it is some type of decorator, but I'm just not sure.

Thanks in advance.

Jason

PerryDaPlatypus
  • 735
  • 1
  • 8
  • 17

0 Answers0