vlc.EventManager ================ .. py:class:: vlc.EventManager Bases: :py:obj:`_Ctype` Create an event manager with callback handler. This class interposes the registration and handling of event notifications in order to (a) remove the need for decorating each callback functions with the decorator ``@callbackmethod``, (b) allow any number of positional and/or keyword arguments to the callback (in addition to the :class:`Event` instance) and (c) to preserve the Python objects such that the callback and argument objects remain alive (i.e. are not garbage collected) until **after** the notification has been unregistered. .. note:: Only a single notification can be registered for each event type in an :class:`EventManager` instance. .. py:attribute:: _callback_handler :value: None .. py:attribute:: _callbacks .. py:method:: event_attach(eventtype, callback, *args, **kwds) Register an event notification. :param eventtype: the desired event type to be notified about. :param callback: the function to call when the event occurs. :param args: optional positional arguments for the callback. :param kwds: optional keyword arguments for the callback. :return: 0 on success, ENOMEM on error. .. note:: The callback function must have at least one argument, an :class:`Event` instance. Any other, optional positional and keyword arguments are in **addition** to the first one. .. warning:: LibVLC is not reentrant, i.e. you cannot call libvlc functions from an event handler. They must be called from the main application thread. .. py:method:: event_detach(eventtype) Unregister an event notification. :param eventtype: the event type notification to be removed.