Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:当用户单击停止按钮时停止Google音频录制_Python_Speech Recognition_Google Speech Api_Google Speech To Text Api - Fatal编程技术网

Python:当用户单击停止按钮时停止Google音频录制

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

即时通讯使用谷歌语音API

系统应按以下方式工作:

1-当用户点击“开始”按钮时,系统应开始记录

2-当用户点击“停止”按钮时,系统应停止记录并显示结果

她是我的“开始”按钮定义

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) 
    
我的问题是,当用户想要停止录制并单击“停止”按钮时,如何调用另一个定义