On 8/7/05, Ronald Oussoren <[EMAIL PROTECTED]> wrote:
> > Here's the objC example from Apple's doc:
> > [appleEventManager setEventHandler:self
> > andSelector:@selector(handleGetURLEvent:withReplyEvent:)
> > forEventClass:kAEInternetSuite andEventID:kAEISGetURL];
> >
> > Here's my translation to Python:
> >             sel = objc.selector
> > (MacController.handleGetURLEvent_withReplyEvent_,
> >                 signature="vO:O:")
> >
> > aem.setEventHandler_andSelector_forEventClass_andEventID_(self,
> >                 sel,
> >                 1735750252L, 1735750252L)
> 
> 
> That's very wrong. You shouldn't call objc.selector unless you're
> defining a new method (in a class definition on the argument for
> objc.classAddMethods). The call to objc.selector should be in the
> class definition of MacController.

I was confused by @selector(handleGetURLEvent:withReplyEvent:) and the
error message I got when I tried my first intuition. My first attempt
was to just pass my Python method, but that complained saying that SEL
was expected instead of an instance method.

I really don't think I would have guessed to pass a string with the
selector name. That and the use of GURL instead of gurl was all it
took to get my program called at the right time.

The PyObjC examples are hugely useful, so this is a great addition to
the pydoc example.

Kevin
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to