如何在文字转语音时打印
How to print while text-to-speech
我希望我的 python 程序在将文本转换为语音时进行打印,但说话后需要一段时间才能输入...请提出任何想法 (:
import pyttsx3
import math
speaker = pyttsx3.init()
speaker.say("Enter operator")
speaker.runAndWait()
print("Valid Operators:\n"
"type \"add\" for adding\n"
"type \"subtract\" for subtracting\n"
"type \"divide\" for dividing\n"
"type \"multiply\" for multiplying\n"
"type \"Square root\" for square-root\n"
"type \"Square\" for square of a number\n")
op = input("Enter your operator:\n")
import pyttsx3
import math
import threading
speaker = pyttsx3.init()
def say_thread(s):
speaker.say(s)
speaker.runAndWait()
def say(s)
x = threading.Thread(target=say_thread, args=("Enter operation",))
x.start()
say( "Enter operation" )
print("Valid Operators:\n"
"type \"add\" for adding\n"
"type \"subtract\" for subtracting\n"
"type \"divide\" for dividing\n"
"type \"multiply\" for multiplying\n"
"type \"Square root\" for square-root\n"
"type \"Square\" for square of a number\n")
op = input("Enter your operator:\n")```
我希望我的 python 程序在将文本转换为语音时进行打印,但说话后需要一段时间才能输入...请提出任何想法 (:
import pyttsx3
import math
speaker = pyttsx3.init()
speaker.say("Enter operator")
speaker.runAndWait()
print("Valid Operators:\n"
"type \"add\" for adding\n"
"type \"subtract\" for subtracting\n"
"type \"divide\" for dividing\n"
"type \"multiply\" for multiplying\n"
"type \"Square root\" for square-root\n"
"type \"Square\" for square of a number\n")
op = input("Enter your operator:\n")
import pyttsx3
import math
import threading
speaker = pyttsx3.init()
def say_thread(s):
speaker.say(s)
speaker.runAndWait()
def say(s)
x = threading.Thread(target=say_thread, args=("Enter operation",))
x.start()
say( "Enter operation" )
print("Valid Operators:\n"
"type \"add\" for adding\n"
"type \"subtract\" for subtracting\n"
"type \"divide\" for dividing\n"
"type \"multiply\" for multiplying\n"
"type \"Square root\" for square-root\n"
"type \"Square\" for square of a number\n")
op = input("Enter your operator:\n")```