Un tableur utilisant le module input (du même créateur) . La formulation comme “a1”, “d5”, “e2” sont autorisé tout comme toutes les fonctions du module math.
from math import * from kandinsky import * from ion import * from time import * from input import r_input cell_w=50 cell_h=21 form={} select=[1,1] result={} for i in "abcdef": for j in "123456789": result[i+j]="0" def get_retour(i): retour="" txt=i[1] if type(txt)==type(42): retour=str(txt) if type(txt)==type("texte"): if len(txt) and txt[0]=="=": try: for j in result.items(): txt=txt.replace(j[0],j[1]) retour=str(eval(txt[1:])) except: retour="Error" else: retour=(len(txt)<(cell_w/10))*txt+(len(txt)>=(cell_w/10))*txt[:(int(cell_w/10)-1)] result[" abcdef"[i[0][0]]+str(i[0][1])]=retour return retour def draw_case(i): draw_string(get_retour(i), i[0][0]*cell_w+5,i[0][1]*cell_h+18) def draw_all(): for x in range(1,int(320/cell_w)+1): fill_rect(x*cell_w,18,3,204,(0,0,0)) draw_string("abcdefghijkl"[x-1],x*cell_w+5,15) for y in range(1,int(222/cell_h)+1): fill_rect(0,y*cell_h+15,320,3,(0,0,0)) draw_string(str(y),0,y*cell_h+18) for i in form.items(): if type(i[1])==type(None): continue draw_case(i) while True: fill_rect( select[0]*cell_w+1,select[1]*cell_h+16, cell_w,cell_h,(255,255,255)) for i in range(0,4): if keydown(i): select[0]+=[-1,0,0,1][i] select[1]+=[0,-1,1,0][i] for i in range(2): if select[i]<1: select[i]=1 draw_all() fill_rect( select[0]*cell_w+1,select[1]*cell_h+16, cell_w,cell_h,(180,180,180)) try: fill_rect(0,0,320,18,(255,255,255)) draw_case((select,form[tuple(select)])) draw_string(form[tuple(select)],10,0) except: fill_rect(0,0,320,18,(255,255,255)) if keydown(KEY_OK): try: form[tuple(select)]=r_input(0,0,text=form[tuple(select)]) except: form[tuple(select)]=r_input(0,0) sleep(0.1)