#gestion des cases a cocher def chk(id,value): global bits if value: bits[id] = 1 else: bits[id] = 0 process(inp.get_text()) #gestion de l'equation def check(val): process(val) #creation de l'interface canvas.add_checkbox("chkA","A",chk,20) canvas.add_checkbox("chkB","B",chk,20) canvas.add_checkbox("chkC","C",chk,20) inp = canvas.add_input("equ:",check,200) inp.set_text("A & (not(B) | not(C))") process(inp.get_text()) def color(value): if value == '1': return 'Yellow' else: return 'White' #ceci est la fonction qui dessine l'ecran toutes les 17 millisecondes def draw(): global bits, out canvas.fill_rect(0,0,500,500) left = 80 top = 30
x = [] y = None for i in range(int(NB_POINTS)+1): ech = 1.0*x_min +1.0*i*((1.0*x_max-1.0*x_min)/(1.0*NB_POINTS)) x.append([ech]) #print x #variables generales varss = {'x': 0 } parser = math2.RpnMathParser(val, varss); out = parser.get_result() y = parser.update(['x'], x ); #print y # #creation de l'interface inp = canvas.add_input("equ:",process,200) inp.set_text("sin(x)") process(inp.get_text()) #ceci est la fonction qui dessine l'ecran toutes les 17 millisecondes def draw(cnvs): global x_min,y_min,x_max,y_max, x, y #print len(y) #canvas.fill_rect(0,0,W,H) last = (0,H/2) axex = 0 if y == None: return for i in range(len(y)):