canvas.draw_circle((left+250, 50+top), 10, 2, 'Blue', color(str(bits['A']))) canvas.draw_text("A: "+str(bits['A']),(left+15,58+top),24,cl2) canvas.draw_text("L: "+str(bits['A']),(left+265,58+top),24,cl2) canvas.draw_line((0,290+top),(100,290+top),3,'Red') #canvas.draw_line((150,290+top),(300,290+top),3,'Blue') canvas.draw_line((500,290+top),(150,290+top),3,'Blue') canvas.draw_circle((420, 290+top), 30, 2, 'Blue', color(str(bits['A']))) canvas.draw_text("A",(115,270+top),24,cl2) canvas.draw_text("L",(410,240+top),24,cl2) if bits['A'] == 0: canvas.draw_line((100,290+top),(150,270+top),3,'Orange') else: canvas.draw_line((100,290+top),(150,290+top),3,'Orange') """ A FAIRE: Modifier ce programme pour transformer l'interrupteur A en interrupteur normalement ferme et dessiner le circuit en consequence """ canvas.start("Purple") canvas.set_draw_handler(draw)
#canvas_test import canvas canvas.clear_timers() canvas.clear() y = 0 angle = 0 def draw(cvs): global y, angle canvas.draw_line((0,0),(500,500),4,'Red') canvas.draw_image(img,(100,100),(200,200),(160,y),(40,40),angle) y = y +0.1 angle = angle + 1 canvas.set_draw_handler(draw) canvas.start('Yellow') img = canvas.load_image("https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Maple_Leaf_%28from_roundel%29.png/220px-Maple_Leaf_%28from_roundel%29.png")