I'm trying to figure out a way so that the text that gets printed on the screen with the print()
function also gets spoken at the same time. I am currently using the pyttsx3
module, but I don't see how I can do that.
I didn't knew much about what I can try in this scenario. The code below is just an example code.
import pyttsx
engine = pyttsx.init()
print('Sally sells seashells by the seashore.')
engine.say('Sally sells seashells by the seashore.')
print('The quick brown fox jumped over the lazy dog.')
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
I want the print
and engine.say
commands to work together.