[Pythonmac-SIG] More on init
Dethe Elza
delza at livingcode.org
Wed Jul 6 17:52:27 CEST 2005
This works for me:
<snippet>
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder, AppHelper
jabberwocky = '''Twas brillig and the slithy toves
did gyre and gimble in the wabe
all mimsy were the borogroves
and the mome raths outgrabe'''
class SpeechDelegate(NSObject):
def applicationDidFinishLaunching_(self, notification):
synth = NSSpeechSynthesizer.alloc()
synth = synth.initWithVoice_
('com.apple.speech.synthesis.voice.Victoria')
synth.startSpeakingString_(jabberwocky)
app = NSApplication.sharedApplication()
delegate = SpeechDelegate.alloc().init()
app.setDelegate_(delegate)
AppHelper.runEventLoop()
</snippet>
More information about the Pythonmac-SIG
mailing list