The best way to destroy every key in your calculator, funny when used in class with a friend. All of what it does is in the title… :)
from kandinsky import fill_rect as f,draw_string as d;from ion import keydown as k;from time import monotonic as m,sleep from math import * SKY=[0,0,0];TXT1=(255-SKY[0],SKY[1],255-SKY[2]);TXT2=(SKY[0],255-SKY[1],255-SKY[2]);TXT3=(255-SKY[0],255-SKY[1],255-SKY[2]);TXT4=(SKY[0],255-SKY[1],SKY[2]);TXT5=(SKY[0],255-SKY[1],255-SKY[2]);KEYS=["LEFT","UP","DOWN","RIGHT","OK","","MENU","ON","","","","","SHIFT","ALPHA","CUT","COPY","PASTE","CLEAR","EXP","LOG","LOG10","I",",","**","SIN","COS","TAN","PI","SQRT","**2","7","8","9","(",")","","4","5","6","*","/","","1","2","3","+","-","","0",".","x10","ANS","EXE"];X=1;T=4 while 1: f(0,0,320,222,SKY[:]);d("choisissez une touche",50,20,TXT1,SKY[:]) while k(4)or k(56):1 while not k(X):X=(X+1)%56 d("[ "+KEYS[X]+" ]",140-len(KEYS[X])*5,50,TXT3,SKY[:]);d("Choisissez une duree",55,90,TXT1,SKY[:]) first=1 while k(0)or k(3)or k(4)or k(56)or k(X):1 while not (k(4)or k(56)or k(X)): if k(0)or k(3)or first: if first:first=0 T=(T+(k(3)-k(0)))%10 d(" < "+str(T+1)+" > ",130-len(str(T+1))*5,120,TXT2,SKY[:]) while k(0)or k(3):1 d("Appuye pour lancer le test",20,160,TXT1,SKY[:]) while k(X):1 while not k(X):1 f(0,0,320,222,SKY[:]) a=m();clicks=0;c=0 while m()-a<T+1: if k(X)and c==0:clicks+=1;c=1;d(str(clicks),160-len(str(clicks))*5,70,TXT2,SKY[:]) if not k(X)and c:c=0 d(str(floor(m()-a))[:4],145,200,TXT5,SKY[:]) d(str(floor(clicks/(T+1)))[:4]+" cps",180-len(str(round(clicks/(T+1),3))[:4])*2-40,100,TXT4,SKY[:]);sleep(2);d("[Appuyez sur une touche]",40,180,TXT3,SKY[:]) while k(X):1 while not k(X):X=(X+1)%56 while k(X):1