Skip to content

Commit ed2c710

Browse files
authored
Text-to-Speech
1 parent 5f81c30 commit ed2c710

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

Cricket_score.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import bs4 as bs
2+
from urllib import request
3+
from win10toast import ToastNotifier
4+
5+
toaster = ToastNotifier()
6+
7+
url = 'http://www.cricbuzz.com/cricket-match/live-scores'
8+
9+
sauce = request.urlopen(url).read()
10+
soup = bs.BeautifulSoup(sauce,"lxml")
11+
#print(soup)
12+
score = []
13+
results = []
14+
#for live_matches in soup.find_all('div',attrs={"class":"cb-mtch-lst cb-col cb-col-100 cb-tms-itm"}):
15+
for div_tags in soup.find_all('div', attrs={"class": "cb-lv-scrs-col text-black"}):
16+
score.append(div_tags.text)
17+
for result in soup.find_all('div', attrs={"class": "cb-lv-scrs-col cb-text-complete"}):
18+
results.append(result.text)
19+
20+
21+
print(score[0],results[0])
22+
toaster.show_toast(title=score[0],msg=results[0],icon_path='cricket.ico')
23+
24+
#---------------------Completed to Requirement----------------------

TTS.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import win32com.client as wincl
2+
from tkinter import *
3+
4+
5+
def text2Speech():
6+
text = e.get()
7+
speak = wincl.Dispatch("SAPI.SpVoice")
8+
speak.Speak(text)
9+
10+
11+
#window configs
12+
tts = Tk()
13+
tts.wm_title("Text to Speech")
14+
tts.geometry("225x105")
15+
tts.config(background="#708090")
16+
17+
18+
f=Frame(tts,height=280,width=500,bg="#bebebe")
19+
f.grid(row=0,column=0,padx=10,pady=5)
20+
lbl=Label(f,text="Enter your Text here : ")
21+
lbl.grid(row=1,column=0,padx=10,pady=2)
22+
e=Entry(f,width=30)
23+
e.grid(row=2,column=0,padx=10,pady=2)
24+
btn=Button(f,text="Speak",command=text2Speech)
25+
btn.grid(row=3,column=0,padx=20,pady=10)
26+
tts.mainloop()
27+
28+
29+

0 commit comments

Comments
 (0)