#Programa creado por M8AX que muestra un reloj analogico y dice las horas con voz cada hora, o si se lo indicamos las dira cada minuto y marcara entre parentesis la hora cuando esta sea una hora prima es decir #Si son las 02:32:22 analizara el numero 023222 el cual no es primo y no marcara la hora entre parentesis. from __future__ import division from appuifw import * import math, time, e32 import audio radius = 72 bigsize = radius * .975 litsize = radius * .67 mx, my = 88, 72 N = 9 def _raw_input( txt ): return appuifw.query( unicode( txt ), "text" ) def is_prime( n ): j = int( round( math.sqrt( n ) ) ) for i in xrange(3, j+1, 2): e32.ao_yield() if (n % i) == 0: return False return True def draw(hh, mm, ss, colors=(0, 1, 2)): e32.ao_yield() bigd = (90 - (mm*60 + ss) / 10) % 360 litd = (90 - (hh*3600 + mm*60 + ss) / 120) % 360 bigr = bigd * math.pi / 180 litr = litd * math.pi / 180 drawbg(bigd, litd, colors) c.line([mx, my, mx + bigsize*math.cos(bigr), my - bigsize*math.sin(bigr)], 0, width = radius/50) c.line([mx, my, mx + litsize*math.cos(litr), my - litsize*math.sin(litr)], 0, width = radius/33) if (is_prime(int(str(hh)+str(mm)+str(ss))) and int(str(hh)+str(mm)+str(ss)) % 2 <>0) or (int(str(hh)+str(mm)+str(ss))==2): c.text([5, 144-5], u"(( %02d:%02d:%02d ))" % (hh, mm, ss), 0xffffff) else: c.text([5, 144-5], u"%02d:%02d:%02d" % (hh, mm, ss), 0xffffff) def drawbg(bigd, litd, colors=(0, 1, 2)): c.clear(0) table = [] for angle, colorindex in [(bigd - 180/N, 0), (litd - 180/N, 1), ( 90 - 180/N, 2)]: angle %= 360 for i in range(N): color = 255 if colorindex in colors: color = (N-1-i)*color//(N-1) table.append((angle, color, colorindex)) angle += 360/N if angle >= 360: angle -= 360 table.append((0, color, colorindex)) table.sort() table.append((360, None)) fill = [0, 0, 0] for i in range(len(table)-1): angle, color, colorindex = table[i] fill[colorindex] = color if angle < 359: c.pieslice([mx-radius,my-radius,mx+radius,my+radius], angle * math.pi/180, 0, fill=tuple(fill), width=0) c.line([mx+1, my, mx+radius-1, my], tuple(fill)) running = 1 atodas=0 atodas= int( _raw_input(u"Hablar Horas Cada Minuto-1. Solo Seņales Horarias-2.: ") ) appuifw.app.title=u"^MvIiIaX^ Reloj" app.body = c = Canvas() def quit(): global running running = 0 app.exit_key_handler= quit while running: e32.ao_yield() t = time.time() + time.clock()%1 hh, mm, ss = time.localtime(t)[3:6] draw(hh, mm, ss, (0,1,2)) if (mm==0 and ss==0): from audio import * antiro = 'e:\\Sounds\\Digital\\Horas\\'+str(hh)+'.wav' vengaasonar = Sound.open(antiro) vengaasonar.play() if (mm==30 and ss==0): from audio import * antiro = 'e:\\Sounds\\Digital\\Horas\\media.wav' vengaasonar = Sound.open(antiro) vengaasonar.play() if atodas==1: if (ss==0 and mm<>30 and mm<>0): from audio import * antiro = 'e:\\Sounds\\Digital\\Horas\\'+str(hh)+'.wav' vengaasonar = Sound.open(antiro) vengaasonar.play() e32.ao_sleep(3) from audio import * antiro = 'e:\\Sounds\\Digital\\Horas\\'+str(mm)+'m.wav' vengaasonar = Sound.open(antiro) vengaasonar.play() e32.ao_sleep(3) e32.ao_sleep(1-t%1)