# This program draws an animated driving car. from drawingpanel import * # Draws a car at the given x/y position. def car(panel, x, y): panel.canvas.create_rectangle(x, y, x+100, y+50, fill="black") panel.canvas.create_oval(x+10, y+40, x+30, y+60, fill="red", outline="red") panel.canvas.create_oval(x+70, y+40, x+90, y+60, fill="red", outline="red") panel.canvas.create_rectangle(x+70, y+10, x+100, y+30, fill="cyan", outline="cyan") # main panel = DrawingPanel(500, 100) panel.set_background("gray") for x in range(0, 550, 10): # draw the car and then pause to produce animation panel.clear() car(panel, x, 10) panel.sleep(20)