I want pyttsx3 and tkinter-text go synchronically. I mean, I want to see what I told in a text like the subtitles However I could not manage that. It is possible when it is not in a while loop.... but when I use it in while loop it shows the the whole dialogue after the speech is done. Do you guys have any idea how to make them go synchronically when in a while loop? Thank you for your help.
with sr.Microphone() as source:
while True:
r.adjust_for_ambient_noise(source, duration=1)
voice = r.listen(source)
text_punk = r.recognize_google(voice, language="en-US")
text_punk = text_punk.lower()
punk_screen = "You---> " + text_punk
txt.insert(END, "\n" + punk_screen)
if text_punk != '':
test=testpy.Testing()
res = test.response(text_punk)
txt.insert(END, "\n" + 'Bot---> ' + res)
talk(res)