I need to repeat a sound every time I click at button, but it just play the audio one single time.
There is the code:
from playsound import playsound
from gtts import gTTS
from tkinter import *
window = Tk()
window.title("Text to Speech")
window.geometry('640x480')
lbl = Label(window, text="Text to speech", font=("Arial Bold", 20))
lbl.grid(column=0, row=0)
txt = Entry(window, width=90)
txt.grid(column=0, row=1)
lbl_texto = Label(window, text="O texto vai aqui")
lbl_texto.grid(column=0, row=2)
def clicked_btn():
texto = txt.get()
lbl_texto.configure(text= texto)
language = 'pt-BR'
obj = gTTS(text=texto, lang=language, slow=False)
obj.save('audio.mp3')
audio = 'audio.mp3'
playsound(audio)
window.update()
btn = Button(window, text="Executar", command=clicked_btn)
btn.grid(column=0, row=10)
window.mainloop()
Tried change the playsound module to OS but nothing happened.