from drawingpanel import * # lists of points FRONT_POINTS=[128,53,4,81,5,117,60,138,168,135] MIDDLE_POINTS=[168,135,265,134,295,81,294,6,193,6,128,53] BACK_POINTS=[294,6,295,81,265,134,380,132,430,111,429,53] SIDE_WINDOW=[295,13,295,59,314,60,314,19,295,13] DRIVERS_WINDOW=[193,14,137,58,280,59,279,13,193,14] BACK_WINDOW=[321,23,321,60,421,61,321,23] GRILL_POINTS=[14,77,3,82,4,117,13,121,14,77] WHEEL_ONE=[60,100,126,166] WHEEL_TWO=[310,100,376,166] STRIPE=[4,98,429,98] FRONT_DOOR_EDGE=[128,53,168,135] BACK_DOOR_EDGE=[265,134,295,81,294,6] # This stuff uses advanced material. def shift(lst,dx,dy): """Takes a list in the form of x0,y0,...xN,yN and shifts them by dx and dy as expected.""" result=[] for i in range(length(lst)): if i%2==0: result.append(lst[i]+dx) else: result.append(lst[i]+dy) return result def scale(lst,factor): return map(lambda x: x*factor,lst) def delorean(g,front_color="#c9c9c9",middle_color="#c9c9c9",back_color="#c9c9c9"): #front g.create_polygon(FRONT_POINTS,fill=front_color) #middle g.create_polygon(MIDDLE_POINTS,fill=middle_color) #back g.create_polygon(BACK_POINTS,fill=back_color) # side window g.create_polygon(DRIVERS_WINDOW,fill="black") # back window g.create_polygon(BACK_WINDOW,fill="black") # side thingy g.create_polygon(SIDE_WINDOW,fill="#878787") # front grill g.create_polygon(GRILL_POINTS,fill="black") # wheel g.create_oval(WHEEL_ONE,fill="gray",width=12) g.create_oval(WHEEL_TWO,fill="gray",width=12) g.create_line(STRIPE,width=4) g.create_line(FRONT_DOOR_EDGE,width=2) g.create_line(BACK_DOOR_EDGE,width=2) panel = DrawingPanel(500,300) g = panel.getGraphics() delorean(g,front_color="pink") panel.mainloop()