1

I figured out how to simulate typing using:

hello_world = 'Hello World, I am typing'

import os
import time
import sys

for letter in hello_world:
      sys.stdout.write(letter)
      sys.stdout.flush()
      time.sleep(0.1) 

And I also figured out how to do text to speech using pyttsx3

import os
import pyttsx3

engine =pyttsx3.init()

hello_speech = 'Hello World, I am typing'

engine.say(hello_speech)
engine.runAndWait()

I was thinking of putting the text-to-speech into a for loop so that it would say each word one by one using .splt() to iterate each one. I want python to say the text that it is typing out simultaneously.

Basically, I want it to be like the computer from War Games: https://www.youtube.com/watch?v=KXzNo0vR_dU at 0:25 in the clip

Seaborg
  • 35
  • 1
  • 5
  • You can use the Threading or the Multiprocessing library to run two loops at the same time. – Jerry Aug 02 '22 at 19:17

0 Answers0