# drawHouse.py Draw some houses on the screen # P. Conrad for CS5nm, 10/06/2008 # stuff we need to import in order to use PyGame import pygame from pygame.locals import * from sys import exit # set up a window size = width, height = 640,480 pygame.init() screen = pygame.display.set_mode(size) # set up variables for colors red = (255, 0, 0 ) # an RGB 3-tuple representing red green = (0, 255, 0) white = (255, 255, 255) # main loop while True: # loop forever (or at least until someone generates a QUIT event) for event in pygame.event.get(): if event.type == QUIT: pygame.quit(); exit() screen.fill(white); # Make the whole screen white points = [(100,100), (100,200), (220,200), (220,100), (100,100), (160,50), (220,100)] lineThickness = 2 pygame.draw.lines(screen, red, False, points, lineThickness) points = [(300,100), (300,200), (420,200), (420,100), (300,100), (360,50), (420,100)] lineThickness = 2 pygame.draw.lines(screen, red, False, points, lineThickness) pygame.display.update()