hi, I'm trying to convert the objective-c class iTunesConnection.h shown below to a pyobjc class. What I've done so far is shown in iTunesConnection.py. The following line
nc.addObserver_selector_name_object_(self, selector(updateNow), u"com.apple.iTunes.playerInfo",None) returns an error: "global name 'selector' is not defined" I'm very new to objc and pyobjc, and I'm investigating what's wrong here, but if anybody could help... thanks! Julien *************************iTunesConnection.h**************************************** #import <Foundation/NSDistributedNotificationCenter.h> #import <Foundation/NSString.h> #import <AppKit/NSAppleScriptExtensions.h> @interface iTunesConnection : NSObject - (id) init; @end @implementation iTunesConnection - (id) init { NSDistributedNotificationCenter *nc = [NSDistributedNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(updateNow:) name:@"com.apple.iTunes.playerInfo" object:nil]; return self; } - (void) updateNow:(NSNotification *)notification { NSString *updateScript = [NSString stringWithFormat:@"tell application \nend tell"]; NSAppleScript *as = [[[NSAppleScript alloc] initWithSource:updateScript] autorelease]; [as executeAndReturnError:nil]; } @end ***************************************************************** *************************iTunesConnection.py**************************************** from Foundation import * class iTunesConnection(NSObject): def init(self): self = super(iTunesConnection, self).init() nc = NSDistributedNotificationCenter.defaultCenter() nc.addObserver_selector_name_object_(self, selector(updateNow), u"com.apple.iTunes.playerInfo",None) return self def updateNow(???): ???? ****************************************************************** _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig