Ok Dave I got it to work. I doubt you will write your ttsserver the same way I am but I don't have the time to spend days on this I will finish mine someday maybe by the end of the month if no one else does but if either you are closer to being done or if you want to take what I have done please be my guest. This is a start of a TtsServer so that we can use emacspeak on Mac so without more of my ranting here is what was missing. I did not use AppHelper in my first version thus there was no event loop to send the messages. I should have known there was something like this because in truth this is just a Linux like DBus session. Anyway. After I added the bottom line of the script all I had to do is add the stop to the delegate and it runs perfectly. I have the two first parts of the EmacsSpeak TtsServer protocol working so if you take the below code put it in a python file and run the following two commands ttsserver version ttsserver tts_say This is a sentence I want this to say. If ttsserver is your file and its set execute, these both work. If you define the functions and add them to my dictionary this protocol could probably be done in a couple hours. If you have more done just add the AppHelper and make sure your delegate is correctly named like mine and your off and running. Best of luck if you beat me to the punch please send it to me for testing I would really like to get EmacsSpeak running on Mac. Now below the code is in-between "***Start*** and ***End*** tags. ***start*** #!/Library/Frameworks/Python.framework/Versions/2.7/bin/python #you might have to change the above line import sys from AppKit import * from PyObjCTools import AppHelper class SpeechDelegate(NSObject): # def init(self): # print "t1" # self = super(SpeechDelegate, self).init() # if self is None: return None # print "t2" # return self def speechSynthesizer_didFinishSpeaking_ (self,sender,suc): print "got here" AppHelper.stopEventLoop() speechQueue=[] funcs={} VERSION="0.1 Alpha" #version def version(): voice = NSSpeechSynthesizer.defaultVoice() speech = NSSpeechSynthesizer.alloc().initWithVoice_(voice) speech.setDelegate_(SpeechDelegate.alloc().init()) speech.startSpeakingString_(VERSION) funcs['version']=version #tts_say text def tts_say(text): voice = NSSpeechSynthesizer.defaultVoice() speech = NSSpeechSynthesizer.alloc().initWithVoice_(voice) speech.setDelegate_(SpeechDelegate.alloc().init()) speech.startSpeakingString_(text) funcs['tts_say']=tts_say def parseArgs(args): if len(args)<1: return (false,false) if len(args)<2: return (args[0],False) else: return (args[0]," ".join(args[1:])) def main(argv): cmd,arg=parseArgs(argv) if cmd==False: quit() if arg!=False: funcs[cmd](arg) else: funcs[cmd] () if __name__ == "__main__": main(sys.argv[1:]) AppHelper.runConsoleEventLoop() ***end*** -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Dave Sent: Saturday, January 01, 2011 9:05 PM To: programmingblind@xxxxxxxxxxxxx Subject: Re: Mac python programming Agreed on the crappy docs concerning this. Tried my hand at a speech server using py obj and had the *exact* same problem. Of course, implementing the delegate (NSSpeechSynthesizerDelegate if memory serves), with all methods of the protocol yields no errors at runtime; it simply just doesn't work. Would be curious to see if anyone has an answer as well. On 1/1/11, Ken Perry <whistler@xxxxxxxxxxxxx> wrote: > > > Has anyone created a command line application and made use of delegates with > pyobjc under Mac? I am working on a project that uses the > NSSpeechSynthesizer class in coco and I can make the program talk fine but > I am not getting the didFinishSpeaking delegate message. If you know what I > am talking about I can send you some simple sample code to check and see if > I am doing this correct. I have to say the pyobjc documentation and sample > programs suck. > > > > Ken > > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind