Skip to content

Commit

Permalink
Text-to-Speech
Browse files Browse the repository at this point in the history
  • Loading branch information
the-vishal authored Dec 1, 2017
1 parent 5f81c30 commit ed2c710
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Cricket_score.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import bs4 as bs
from urllib import request
from win10toast import ToastNotifier

toaster = ToastNotifier()

url = 'http://www.cricbuzz.com/cricket-match/live-scores'

sauce = request.urlopen(url).read()
soup = bs.BeautifulSoup(sauce,"lxml")
#print(soup)
score = []
results = []
#for live_matches in soup.find_all('div',attrs={"class":"cb-mtch-lst cb-col cb-col-100 cb-tms-itm"}):
for div_tags in soup.find_all('div', attrs={"class": "cb-lv-scrs-col text-black"}):
score.append(div_tags.text)
for result in soup.find_all('div', attrs={"class": "cb-lv-scrs-col cb-text-complete"}):
results.append(result.text)


print(score[0],results[0])
toaster.show_toast(title=score[0],msg=results[0],icon_path='cricket.ico')

#---------------------Completed to Requirement----------------------
29 changes: 29 additions & 0 deletions TTS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import win32com.client as wincl
from tkinter import *


def text2Speech():
text = e.get()
speak = wincl.Dispatch("SAPI.SpVoice")
speak.Speak(text)


#window configs
tts = Tk()
tts.wm_title("Text to Speech")
tts.geometry("225x105")
tts.config(background="#708090")


f=Frame(tts,height=280,width=500,bg="#bebebe")
f.grid(row=0,column=0,padx=10,pady=5)
lbl=Label(f,text="Enter your Text here : ")
lbl.grid(row=1,column=0,padx=10,pady=2)
e=Entry(f,width=30)
e.grid(row=2,column=0,padx=10,pady=2)
btn=Button(f,text="Speak",command=text2Speech)
btn.grid(row=3,column=0,padx=20,pady=10)
tts.mainloop()



0 comments on commit ed2c710

Please sign in to comment.