Skip to content

Commit 954a812

Browse files
Listening for Events
1 parent 47871bd commit 954a812

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pyttsx3/events.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#This Example based on Listening for events
2+
3+
import pyttsx3
4+
def onStart(name):
5+
print 'starting', name
6+
def onWord(name, location, length):
7+
print 'word', name, location, length
8+
def onEnd(name, completed):
9+
print 'finishing', name, completed
10+
engine = pyttsx3.init()
11+
engine.connect('started-utterance', onStart)
12+
engine.connect('started-word', onWord)
13+
engine.connect('finished-utterance', onEnd)
14+
engine.say('The quick brown fox jumped over the lazy dog.')
15+
engine.runAndWait()

0 commit comments

Comments
 (0)