Python Tkinter Text to Audio GUI App Using GTTS Library Full Tutorial

Python Tkinter Text to Audio GUI App Using GTTS Library Full Tutorial

Welcome Folks today in this blog post I will be talking about how to convert text to audio using gtts library in a gui application using tkinter library in python. Let’s get started step by step in the youtube video as follows.




pip install tkinter



pip install gtts


Now after installing these two libraries copy paste the following code to make this application. In this block of code we will be making the gui application using tkinter and then writing the code to convert the text written to a audio file and play the audio file also. For Playing the audio file we will be installing another library called PlaySound.


pip install playsound


from tkinter import *

from gtts import gTTS 

from playsound import playsound

def convert_audio():
    address_info = address.get()
    language = 'en'
    myobj = gTTS(text=address_info, lang=language, slow=False)"welcome.mp3") 

app = Tk()


app.title("Python Text to Audio App")

heading = Label(text="Python Text to Audio",bg="yellow",fg="black",font="10",width="500",height="3")


address_field = Label(text="Text :"),y=70)

address = StringVar()

address_entry = Entry(textvariable=address,width="30"),y=100)

button = Button(app,text="Convert to Audio",command=convert_audio,width="30",height="2",bg="grey"),y=140)



See also  FFMPEG Command to Convert MOV Video File to MP4 Video File in Windows 10 Full Tutorial For Beginners



Leave a Reply