Skip to content

Commit be1668f

Browse files
authored
Merge pull request Shahrayar123#88 from AKSH2002/master
Added Text-to-Speech
2 parents fd76750 + 4f4761a commit be1668f

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ This repository has the following Projects.
4545
- [Web_Automation](https://github.com/Shahrayar123/Python-Projects/tree/master/Web_Automation)
4646
- [Youtube Searching Script](https://github.com/Shahrayar123/Python-Projects/tree/master/Youtube%20Searching%20Script)
4747
- [pokemone_battle](https://github.com/Shahrayar123/Python-Projects/tree/master/pokemone_battle.py)
48+
- [Text-to-Speech](https://github.com/Shahrayar123/Python-Projects/tree/master/Text-to-Speech)
4849

4950

5051
## Contribution

Text-to-Speech/Demo.png

10.3 KB
Loading

Text-to-Speech/Text-to-speech.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import tkinter as tk
2+
from tkinter import *
3+
import pyttsx3
4+
5+
engine = pyttsx3.init(driverName='espeak')
6+
7+
8+
def speaknow():
9+
engine.say(textv.get())
10+
engine.runAndWait()
11+
engine.stop()
12+
13+
root=Tk()
14+
15+
textv=StringVar()
16+
17+
obj=LabelFrame(root,text="Text to speech",font=20,bd=1)
18+
obj.pack(fill="both",expand="yes",padx=10,pady=10)
19+
20+
lb1=Label(obj,text="Text",font=30)
21+
lb1.pack(side=tk.LEFT,padx=5)
22+
23+
text=Entry(obj,textvariable=textv,font=30,width=25,bd=5)
24+
text.pack(side=tk.LEFT,padx=10)
25+
26+
btn=Button(obj,text="Speak",font=20,bg="green",fg="white",command=speaknow)
27+
btn.pack(side=tk.LEFT,padx=10)
28+
29+
root.title("Text to speech")
30+
root.geometry("480x200")
31+
root.resizable(False,False)
32+
root.mainloop()

Text-to-Speech/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
tkinter
2+
pyttsx3
3+
espeak-ng # Only if using the espeak driver
4+

0 commit comments

Comments
 (0)