Python:当用户单击停止按钮时停止Google音频录制
即时通讯使用谷歌语音API 系统应按以下方式工作: 1-当用户点击“开始”按钮时,系统应开始记录 2-当用户点击“停止”按钮时,系统应停止记录并显示结果 她是我的“开始”按钮定义Python:当用户单击停止按钮时停止Google音频录制,python,speech-recognition,google-speech-api,google-speech-to-text-api,Python,Speech Recognition,Google Speech Api,Google Speech To Text Api,即时通讯使用谷歌语音API 系统应按以下方式工作: 1-当用户点击“开始”按钮时,系统应开始记录 2-当用户点击“停止”按钮时,系统应停止记录并显示结果 她是我的“开始”按钮定义 def Recite(): r = sr.Recognizer() with sr.Microphone() as source: audio = r.listen(source) try: global s s = r.r
def Recite():
r = sr.Recognizer()
with sr.Microphone() as source:
audio = r.listen(source)
try:
global s
s = r.recognize_google(audio,language ="ar-AR")
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
title4= tk.Label(text ="غير مفهوم ", foreground="red")
title4.grid(column=0,row=16)
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))
title5= tk.Label(text ="حدث خطأ ", foreground="red")
title5.grid(column=0,row=16)
我的问题是,当用户想要停止录制并单击“停止”按钮时,如何调用另一个定义