@@ -224,11 +224,11 @@ Listening for events
224
224
225
225
import pyttsx3
226
226
def onStart(name):
227
- print 'starting', name
227
+ print( 'starting', name)
228
228
def onWord(name, location, length):
229
- print 'word', name, location, length
229
+ print( 'word', name, location, length)
230
230
def onEnd(name, completed):
231
- print 'finishing', name, completed
231
+ print( 'finishing', name, completed)
232
232
engine = pyttsx3.init()
233
233
engine.connect('started-utterance', onStart)
234
234
engine.connect('started-word', onWord)
@@ -243,7 +243,7 @@ Interrupting an utterance
243
243
244
244
import pyttsx3
245
245
def onWord(name, location, length):
246
- print 'word', name, location, length
246
+ print( 'word', name, location, length)
247
247
if location > 10:
248
248
engine.stop()
249
249
engine = pyttsx3.init()
@@ -292,11 +292,11 @@ Running a driver event loop
292
292
293
293
engine = pyttsx3.init()
294
294
def onStart(name):
295
- print 'starting', name
295
+ print( 'starting', name)
296
296
def onWord(name, location, length):
297
- print 'word', name, location, length
297
+ print( 'word', name, location, length)
298
298
def onEnd(name, completed):
299
- print 'finishing', name, completed
299
+ print( 'finishing', name, completed)
300
300
if name == 'fox':
301
301
engine.say('What a lazy dog!', 'dog')
302
302
elif name == 'dog':
0 commit comments