#File: ChapterGraphics/triangle0.py """ Draws two equal triangles in different places """ from graphics import * # file graphics.py must be in the same folder def main(): win = GraphWin("Two triangles") # default size is 200 x 200 x1,y1 = 50,50 x2,y2 = 50,90 x3,y3 = 90,50 tt1 = Polygon([Point(x1,y1),Point(x2,y2),Point(x3,y3)]) tt1.setFill("#00FFF0") tt1.draw(win) step = 30 # move triangle by step tt2 = Polygon([Point(x1+step,y1+step),Point(x2+step,y2+step),Point(x3+step,y3+step)]) tt2.setFill("#F0FF00") tt2.draw(win) main()