this is a very simple app the helps yous to keep track of time. It says the time very 15 minits, by the way you can change it.
it uses pyttsx which can be dowloaded and install.
copy this code and save it as sayTheTime.pyw and double click it.
it also uses python2.7 you should also note that you have to start it every time the computer
reboots
try it and tell me what you think thanks
import pyttsx
import time
def getMom(_mouth):
if _mouth == 1:
return 'january'
elif _mouth == 2:
return 'february'
elif _mouth == 3:
return 'march'
elif _mouth == 4:
return 'april'
elif _mouth == 5:
return 'maye'
elif _mouth == 6:
return 'june'
elif _mouth == 7:
return 'july'
elif _mouth == 8:
return 'august'
elif _mouth == 9:
return 'september'
elif _mouth == 10:
return 'october'
elif _mouth == 11:
return 'november'
elif _mouth == 12:
return 'december'
def getTheTime(_time):
hour = _time.tm_hour % 12
if _time.tm_min == 0 and _time.tm_hour == 0:
return 'the time is 12 midnite'
elif _time.tm_min == 0 and _time.tm_hour == 12:
return 'the time is 12 noon'
elif _time.tm_hour < 12:
if _time.tm_min != 0:
return 'the time is %d: %d am' %(hour, _time.tm_min)
else:
return 'the time is %d oklok am' %(hour)
elif _time.tm_hour == 12:
return 'the time is %d: %d pm' %(_time.tm_hour, _time.tm_min)
elif _time.tm_hour > 12:
if _time.tm_min != 0:
return 'the time is %d: %d pm' %(hour, _time.tm_min)
else:
return 'the time is %d oklok pm' %(hour)
def getDate(day, mouth, year):
if day == 1:
return 'the date is %dst %s %d' %(day, getMom(mouth), year)
elif day == 2:
return 'the date is %dnd %s %d' %(day, getMom(mouth), year)
elif day == 3:
return 'the date is %drd %s %d' %(day, getMom(mouth), year)
else:
return 'the date is %dth %s %d' %(day, getMom(mouth), year)
#strat event loop
#it is a forever loop
speek = pyttsx.init()
speek.setProperty('rate', 100)
#get strat time
start_time = time.localtime()
day = start_time.tm_mday
mouth = start_time.tm_mon
year = start_time.tm_year
start_day = 0
while True:
if start_day != start_time.tm_mday:
speek.say(getDate(start_time.tm_mday, start_time.tm_mon, start_time.tm_year) + getTheTime(start_time))
speek.runAndWait()
start_day = start_time.tm_mday
time.sleep(880)
elif strat_time.tm_min % 15 == 0:
speek.say(getTheTime(start_time))
speek.runAndWait()
time.sleep(880)
strat_time = time.localtime()