from tkinter import *
from gtts import gTTS
import os
root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Converter texto Voz")
titulo = Label(text="Converter texto Voz",
font=("Arial", "28", "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.05, rely=0.05)
texto_sub1 = Label(text="Texto",
font=("Arial", "22", "bold"), bg="#103030", fg="#49e3e3")
texto_sub1.place(relx=0.4, rely=0.25)
texto = StringVar()
texto_entrada = Entry(textvariable=texto,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
texto_entrada.place(relx=0.05, rely=0.4, relwidth=0.9)
def limpar():
texto_entrada.delete(0, END)
def app():
Texto = texto.get()
tts = gTTS(text=Texto, lang='pt', slow=False)
tts.save("audio.mp3")
os.system("start audio.mp3")
but1 = Button(text="Converter", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.1, rely=0.65, relwidth=0.25, relheight=0.1)
but_limpar = Button(text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=limpar)
but_limpar.place(relx=0.4, rely=0.65, relwidth=0.25, relheight=0.1)
but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=root.destroy)
but_sair.place(relx=0.7, rely=0.65, relwidth=0.25, relheight=0.1)
root.mainloop()