Código
import random import sys import pygame from pygame.locals import * def genera_matrix(posx,posy): font = pygame.font.Font(None,20) cadena = "abcdefghijklmnopkrstuvwxyz1234567890!#$%&/()=?*[]_:;" posicion = [] while 1: pygame.event.pump() keyinput = pygame.key.get_pressed() if keyinput[K_ESCAPE] or pygame.event.peek(QUIT): sys.exit(2) if posx not in posicion: car = random.randrange(len(cadena)) green = random.randrange(50,75) text = font.render(cadena[car],1,(32,green,32)) screen.blit(text,(posx,posy)) if (posy >= 0 and posy <= SCREEN_HEIGHT): posy = posy + 12 if posy >= SCREEN_HEIGHT: posicion = posicion + [posx] posx = random.randrange(SCREEN_WIDTH) posy = random.randrange(SCREEN_HEIGHT) screen.blit(text,(posx,posy)) pygame.display.flip() pygame.time.wait(100) else: posx = random.randrange(SCREEN_WIDTH) posy = random.randrange(SCREEN_HEIGHT) def genera_binario(): font = pygame.font.Font(None,16) posx_ini = 0 posy_ini = 0 posx_fin = SCREEN_WIDTH posy_fin = SCREEN_HEIGHT cadena_binario = "01" while 1: car = random.randrange(len(cadena_binario)) green = random.randrange(0,39) text = font.render(cadena_binario[car],1,(12,green,12)) screen.blit(text,(posx_ini,posy_ini)) if (posx_ini >= 0 and posx_ini <= posx_fin): posx_ini = posx_ini + 10 else: posx_ini = 0 posy_ini = posy_ini + 10 if posx_ini == posx_fin and posy_ini == posy_fin: posx = random.randrange(SCREEN_WIDTH) posy = 0 genera_matrix(posx,posy) pygame.display.flip() def main(): if not pygame.font: print "Desabilitado Tipo de Letras" else: pygame.font.init() global SCREEN_WIDTH, SCREEN_HEIGHT, screen SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 pygame.init() screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT)) pygame.display.set_caption("PyMatrix") genera_binario() if __name__=="__main__": main()