[EuroPython] Help me finalise my PyObjC talk!

Luke Kenneth Casson Leighton luke.leighton at googlemail.com
Thu Jun 25 19:58:48 CEST 2009


sorry, orestis, hit send too early: how to set up event listeners as
well.  i.e. how to add a python callback onto e.g. window.resize and
onto W3C Element (actually Node) "click" listener.

i have an example which is using python-hulahop which is python
bindings to XUL / Gecko, here:
http://lkcl.net/pyjamas/python-xpcom.tgz  the key file is hula.py

intuitively using PyObjC + cocoa, i would expect things to be pretty
identical to this:

        listener = xpcom.server.WrapObject(ContentInvoker(self),
                                            interfaces.nsIDOMEventListener)
        self.window_root.addEventListener('click', listener, False)

where ContentInvoker has a function handleEvent, which in the example does this:

    def handleEvent(self, event):
        print event

duh :)

clue?


More information about the EuroPython mailing list