(self, *args)
Function decorator for an event handler.  
        
        Usage::

            win = window.Window()

            @win.event
            def on_resize(self, width, height):
                # ...

        or::

            @win.event('on_resize')
            def foo(self, width, height):
                # ...
Function decorator for an event handler.  
        
        Usage::
Function decorator for an event handler . Usage ::
def event(self, *args):
        '''Function decorator for an event handler.  
        
        Usage::

            win = window.Window()

            @win.event
            def on_resize(self, width, height):
                # ...

        or::

            @win.event('on_resize')
            def foo(self, width, height):
                # ...

        '''
        if len(args) == 0:                      # @window.event()
            def decorator(func):
                name = func.__name__
                self.set_handler(name, func)
                return func
            return decorator
        elif inspect.isroutine(args[0]):        # @window.event
            func = args[0]
            name = func.__name__
            self.set_handler(name, func)
            return args[0]
        elif type(args[0]) in (str, unicode):   # @window.event('on_resize')
            name = args[0]
            def decorator(func):
                self.set_handler(name, func)
                return func
            return decorator
def event ( self , * args ) : if len ( args ) == 0 : # @window.event() def decorator ( func ) : name = func . __name__ self . set_handler ( name , func ) return func return decorator elif inspect . isroutine ( args [ 0 ] ) : # @window.event func = args [ 0 ] name = func . __name__ self . set_handler ( name , func ) return args [ 0 ] elif type ( args [ 0 ] ) in ( str , unicode ) : # @window.event('on_resize') name = args [ 0 ] def decorator ( func ) : self . set_handler ( name , func ) return func return decorator