Kaveh Sabouri
Posted on October 18, 2022
Hello everyone today we want make text to speech app with python.
for this project we must install gtts module.
Write this in your terminal for install it:
pip install gtts
Code:
from tkinter import *
from tkinter import messagebox
from gtts import gTTS
window = Tk()
window.title("Text to Speech")
window.config(bg="#C9CBA3")
window.geometry("500x500")
def change():
if entry.get() == "":
messagebox.showerror("Error","No text to speak")
else:
messagebox.showinfo("Info","Please wait")
speech = gTTS(text=entry.get())
speech.save("speech.mp3")
label_welcome = Label(window,text="Text to speech",font=("Lalezar",40),fg="#E26D5C",bg="#C9CBA3")
label_welcome.pack()
entry = Entry(window)
entry.focus()
entry.place(x=130,y=220,width=250,height=30)
button_change = Button(window,text="Change",bg="#E26D5C",command=change,font=("",20))
button_change.place(x=195,y=400)
window.mainloop()
This is a output of project:
This application has been tested on Mac, and its appearance may change in Windows or Linux.
Thank you for reading this post.
💖 💪 🙅 🚩
Kaveh Sabouri
Posted on October 18, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.