#!/usr/bin/env python #original code from Game Development with Python and Pygame by Will McGugan import pygame from pygame.locals import * from sys import exit from math import * pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) j=0 while True: for event in pygame.event.get(): if event.type == QUIT: exit() screen.fill((0, 0, 0)) mouse_pos = pygame.mouse.get_pos() random_pos = (j%640, 240 + 40*sin(j/15)) for x in xrange(0,640,20): pygame.draw.line(screen, (255, 0, 0), (x, 0), random_pos,3) pygame.draw.line(screen, (255, 0, 0), (x, 479), random_pos,3) for y in xrange(0,480,20): pygame.draw.line(screen, (0, 255, 0), (0, y), random_pos,3) pygame.draw.line(screen, (0, 255, 0), (639, y), random_pos,3) j = j+5 pygame.display.update()