Chronomètre sur la calculatrice !
Donnez simplement le temps en secondes au démarrage du programme.
from math import * from kandinsky import * from time import * n=20 try: # On teste si on a la chance d'avoir Omega draw_line(0,0,0,0,(0,0,0)) except: # Si on n'en profite pas je fais une # alternative "du pauvre" def draw_line(x1,y1,x2,y2,c): width=int((x2+x1+y2+y1)/(4*n)) for i in range(1,n+1): fill_rect((x1*i+x2*(n-i))//n-width,(y1*i+y2*(n-i))//n-width,width*2,width*2,c) t=float(eval(input("Combien de secondes ? "))) if t<10: n=20 elif t<20: n=40 else: n=80 fill_rect(0,0,320,222,(0,)*3) for i in [3,2,1]: draw_string(str(i)+"..",150,96,(255,)*3,(0,)*3) sleep(1) fill_rect(0,0,320,222,(0,)*3) t_start=monotonic() while t_start+t>monotonic(): f=(monotonic()-t_start)/t a=f*2*pi-1/2*pi draw_line(160,111,160+int(100*cos(a)),111+int(100*sin(a)),(255-int(255*f),int(255*f),0))