Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyttsx3
- import threading
- import time
- halt = 0
- class KeyEventThread(threading.Thread):
- def run(self):
- while (True):
- global halt
- #print("Hello")
- #time.sleep(10)
- z = input('Press enter to pause')
- halt = 1
- kethread = KeyEventThread()
- kethread.start()
- engine = pyttsx3.init()
- #engine.say('The quick brown fox jumped over the lazy dog.')
- #engine.runAndWait()
- fname = "marks.txt"
- with open(fname) as f:
- content = f.readlines()
- #Remove whitespace characters like `\n` at the end of each line
- content = [x.strip() for x in content]
- for mark in content:
- if (halt == 1):
- #break
- time.sleep(10)
- halt = 0
- print ('saying ' + mark)
- engine.say(mark)
- engine.say('.')
- engine.runAndWait()
- #input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement