Oh Snap!

Please turnoff your ad blocking mode for viewing your site content

Hit enter after type your search item

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

/
/
/
303 Views

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.

READ  PyInstaller Tutorial to Convert Python Scripts (.py) to .EXE Files Full Tutorial

 

Requirements

 

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.

READ  Python Tutorial Compressing and Extracting Files Using ZipFile Library Full Project

 

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)
    
    myobj.save("welcome.mp3") 
    
    playsound("welcome.mp3")
    
        
    print(address_info)
    
    address_entry.delete(0,END)    
    
    

app = Tk()

app.geometry("500x500")

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

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

heading.pack()

address_field = Label(text="Text :")

address_field.place(x=15,y=70)

address = StringVar()


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

address_entry.place(x=15,y=100)

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

button.place(x=15,y=140)

mainloop()

 

READ  Python OpenCV Tutorial To Capture Images From Webcam Full Project

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views :