Have you ever wanted to create your own Text-to-Speech (TTS) application using Python? 🤔
Well, in this blog, I’ll walk you through how I built a Text-to-Speech converter with Tkinter – a simple yet powerful Python GUI project that turns text into natural-sounding speech and even allows you to save the audio as an MP3 file.
This project is perfect for:
✅ Beginners in Python who want to practice GUI programming.
✅ Students looking for Python projects with source code.
✅ Anyone curious about speech synthesis applications.
By the end, you’ll have your very own desktop app that takes input text, speaks it aloud, and saves it as audio. Exciting, right? Let’s dive in! 🚀
🛠️ Technologies & Libraries Used
Here’s what we’ll use in this project:
- Python 3 – Core programming language.
- Tkinter → for creating the graphical user interface (GUI).
- pyttsx3 → a Python library for text-to-speech conversion.
- OS & Filedialog → for saving audio files on your system.
👉 Install pyttsx3
if you don’t have it:
pip install pyttsx3
📌 If you’re new to Tkinter, you can check out Python’s official Tkinter documentation for basic widgets and layouts.
📌 Step 1: Importing Libraries
We’ll start by importing the required Python libraries and initializing our main Tkinter window.
from tkinter import *
from tkinter import filedialog
from tkinter.ttk import Combobox
import pyttsx3
import os
root = Tk()
root.title("Text to Speech")
root.geometry("900x500+200+200")
root.resizable(0,0)
root.configure(bg="#005BEA")
engine = pyttsx3.init()
✅ Here we:
- Created a window using Tkinter.
- Set title, size, background color.
- Initialized the speech engine using
pyttsx3
.
📌 Step 2: Adding Icons, Frames & Labels
We’ll make the app visually appealing with a logo, heading, and text area.
# Icon
image_icon = PhotoImage(file="speak.png")
root.iconphoto(False, image_icon)
# Top Frame
Top = Frame(root, bg="#BAC8E0", width=900, height=150).place(x=0, y=0)
logo = PhotoImage(file="miclogo1.png")
Label(Top, image=logo, bg="#BAC8E0").place(x=20, y=10)
lbl = Label(Top, text="TEXT TO SPEECH", fg="#005BEA", bg="#BAC8E0", font="comicsnsms 35 bold").place(x=150, y=50)
# Text Area
txt = Text(root, font="Robote 18", bg="white", relief=RAISED, wrap=WORD)
txt.place(x=20, y=200, width=500, height=250)
💡 Pro Tip: Always use consistent fonts and colors in GUI projects for a professional look.
📌 Step 3: Adding Dropdowns & Buttons
We’ll add voice selection (Male/Female), speech speed (Fast, Normal, Slow), and buttons to Speak or Save.
# Widgets
Label(root, text="VOICE", font="Roboto 16 bold", bg="#005BEA", fg="white").place(x=590, y=220)
Label(root, text="SPEED", font="Roboto 16 bold", bg="#005BEA", fg="white").place(x=760, y=220)
gender1 = Combobox(root, values=['Male','Female'], font="Robote 15", state='r', width=10)
gender1.place(x=560, y=250)
gender1.set('Male')
speed1 = Combobox(root, values=['Fast','Medium','Slow'], font="Robote 15", state='r', width=10)
speed1.place(x=730, y=250)
speed1.set('Normal')
# Buttons
imageicon = PhotoImage(file="speak1.png")
btn = Button(root, text="Speak", compound=LEFT, image=imageicon, width=130, height=60, font="Roboto 15", bg="#BAC8E0", fg="#005BEA", command=speak)
btn.place(x=560, y=350)
imageicon2 = PhotoImage(file="download2.png")
btn2 = Button(root, text="Save", compound=LEFT, image=imageicon2, width=130, height=60, font="Roboto 15", bg="#BAC8E0", fg="#005BEA", command=save)
btn2.place(x=730, y=350)
📌 Step 4: Speak Function
This function reads the text aloud.
def speak():
text = txt.get(1.0, END)
gender = gender1.get()
speed = speed1.get()
voices = engine.getProperty('voices')
def setvoice():
if gender == 'Male':
engine.setProperty('voice', voices[0].id)
else:
engine.setProperty('voice', voices[1].id)
engine.say(text)
engine.runAndWait()
if text:
if speed == "Fast":
engine.setProperty('rate', 250)
elif speed == "Normal":
engine.setProperty('rate', 180)
else:
engine.setProperty('rate', 50)
setvoice()
📌 Step 5: Save Function
This function saves the spoken text as an MP3 file.
def save():
text = txt.get(1.0, END)
gender = gender1.get()
speed = speed1.get()
voices = engine.getProperty('voices')
def setvoice():
if gender == 'Male':
engine.setProperty('voice', voices[0].id)
else:
engine.setProperty('voice', voices[1].id)
path = filedialog.askdirectory()
os.chdir(path)
engine.save_to_file(text, 'text.mp3')
engine.runAndWait()
if text:
if speed == "Fast":
engine.setProperty('rate', 250)
elif speed == "Normal":
engine.setProperty('rate', 180)
else:
engine.setProperty('rate', 50)
setvoice()
🎯 Final Output
When you run this program, you’ll get a beautiful Text-to-Speech GUI app.
✔️ Enter text in the box
✔️ Choose Male/Female voice
✔️ Select speech speed (Fast, Normal, Slow)
✔️ Click Speak to hear the voice
✔️ Click Save to download it as an MP3
Here’s a sneak peek 👇
📌 Why This Project is Useful?
- A great Python Tkinter beginner project.
- Helps understand GUI + pyttsx3 integration.
- Can be extended to support different languages using Google Text-to-Speech (gTTS).
- Useful for visually impaired users, e-learning, audiobooks, and content creators.
- A good portfolio project if you’re applying for internships or jobs.
🔗 Related Learning Resources
- 📖 Tkinter Official Documentation
- 🎤 pyttsx3 Documentation
- 📝 Build More Python Projects
- 💻 Internal Link: Beginner-Friendly Python Projects (Your Blog Link)
🏆 Conclusion
Building this Text-to-Speech app using Python Tkinter was a fun and practical experience.
With just a few lines of code, we created a working desktop app that converts text into speech and saves it as audio.
If you’re learning Python, this project is a perfect step toward mastering GUI development.
👉 Try it out, add more features like multi-language support or different voice models, and make it your own!
🔑 SEO Meta Details
Meta Title: Python Tkinter Project: Build a Text-to-Speech (TTS) App with pyttsx3
Meta Description: Learn how to build a Python Text-to-Speech (TTS) application using Tkinter and pyttsx3. Step-by-step guide with code to convert text into speech and save as MP3.
Keywords: Python Tkinter project, text to speech in Python, Python pyttsx3 tutorial, Python GUI projects, Tkinter beginner project, Python text to audio, Tkinter speech synthesis
must read previous blog : 7 Best AI-Powered WordPress Plugins to Supercharge Your Website in 2025
Your blog is a testament to your dedication to your craft. Your commitment to excellence is evident in every aspect of your writing. Thank you for being such a positive influence in the online community.
Simply desire to say your article is as surprising The clearness in your post is simply excellent and i could assume you are an expert on this subject Fine with your permission let me to grab your feed to keep up to date with forthcoming post Thanks a million and please carry on the gratifying work
Normally I do not read article on blogs however I would like to say that this writeup very forced me to try and do so Your writing style has been amazed me Thanks quite great post
Thanks I have just been looking for information about this subject for a long time and yours is the best Ive discovered till now However what in regards to the bottom line Are you certain in regards to the supply
helloI really like your writing so a lot share we keep up a correspondence extra approximately your post on AOL I need an expert in this house to unravel my problem May be that is you Taking a look ahead to see you
I just could not leave your web site before suggesting that I really enjoyed the standard information a person supply to your visitors Is gonna be again steadily in order to check up on new posts
Your writing is not only informative but also incredibly inspiring. You have a knack for sparking curiosity and encouraging critical thinking. Thank you for being such a positive influence!