嗨我有一个识别我的声音并在python shell中打印的代码。
现在我希望它在所选文本框中打印文本,我该怎么办?
代码是:
import speech_recognition as sr
def start():
r = sr.Recognizer()
with sr.Microphone() as source:
print("listening started")
audio = r.listen(source)
WIT_AI_KEY = "what ever"
try:
print("Wit.ai thinks you said " + r.recognize_wit(audio, key=WIT_AI_KEY))
except sr.UnknownValueError:
print("Wit.ai could not understand audio")
except sr.RequestError as e:
print("Could not request results from Wit.ai service; {0}".format(e))
start()
start()