Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from StackOverflow import Speak
- import datetime
- def time_compare():
- now = datetime.datetime.now()
- today12pm = now.replace(hour=12,minute=0,second=0,microsecond=1)
- today4pm = now.replace(hour=15,minute=0,second=0,microsecond=0)
- today6pm = now.replace(hour=18, minute=0, second=0, microsecond=0)
- if now < today12pm:
- Speak.Sen_speak ("Good Morning Shiv!")
- elif today12pm <= now and now < today4pm:
- Speak.Sen_speak("Good Afternoon Shiv")
- elif today4pm <= now and now <today6pm:
- Speak.Sen_speak("Good Evening Shiv")
- else:
- Speak.Sen_speak("It seems to be night, are we really going to work")
- input("Press Enter To exit")
- time_compare()
- import pyttsx
- def Sen_speak(msg):
- try:
- engine = pyttsx.init()
- engine.setProperty('voice', 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftSpeechVoicesTokensTTS_MS_EN-US_ZIRA_11.0')
- engine.say(msg)
- engine.runAndWait()
- return 'said'
- except:
- return 'Err'
- def Testing_method():
- message = raw_input("Enter To Speak")
- result = Sen_speak(message)
- if result == 'said':
- print ("Said Successfully")
- else:
- print ("Error With Sound")
- #Testing_method()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement