[Pythonmac-SIG] Using UKKQueue with PyObjC
Florian Munz
newsletter at theflow.de
Tue Mar 8 16:54:06 CET 2005
Bob Ippolito <bob at redivi.com> wrote:
> It's automatically generated from the Xcode project and is a relatively
> general solution, so it's not minimal. Works fine with --alias here,
> you should try it with py2app svn trunk.
Okay, since I'm am not using XCode I thought there must be a simpler
way.
> You probably can use any Python class, but the most well tested
> solution is to use a NSObject subclass whenever you have code that is
> going to be called from Objective-C, so I would recommend doing that.
I tried subclassing NSObject but now I am not sure about the right way
to create an object. Take this minimal example:
class Converter (NSObject):
def init(self):
self = NSObject.init(self)
NSWorkspace.sharedWorkspace().notificationCenter().
addObserver_selector_name_object_(
self, "documentChanged:",
None,
None)
return self
def documentChanged_(self, notification):
print 'handleChange'
If I instantiate this class from the Main-Class with
Converter.alloc().init() my application dies quickly (Crash Reporter,
nothing in the logs). If I however instantiate it from Interface Builder
it works. Is this a bug or a feature? :)
I don't want to instantate it from IB, because I have 4 of these classes
and don't need all of them everytime.
thanks,
Florian
More information about the Pythonmac-SIG
mailing list