All pastes #717722 Raw Edit

viex.py

public python v1 · immutable
#717722 ·published 2007-09-27 20:25 UTC
rendered paste body
#!/usr/bin/pythonimport pygame, sys, os, randomfrom pygame.locals import *#from modele import BilleRED = (255,0,0)BLUE = (0,0,255)GREEN = (0,255,0)YELLOW = (255,255,0)PURPLE = (255,0,255)SKY = (0,255,255)WHITE = (255,255,255)COLORS = [RED,BLUE,GREEN,YELLOW,PURPLE,SKY,WHITE]COLOR = WHITEZOOM = 20RADIUS = ZOOM/2WIDTH = 0class View:    def __init__(self,width,height):        self.rect = Rect(0, 0, (width+1)*ZOOM, (height+1)*ZOOM)        self.background = (0,0,0)        pygame.init()        self.screen = pygame.display.set_mode(self.rect.size, 0)        self.clock = pygame.time.Clock()    def show(self,bille):        pygame.draw.circle(self.screen,                           COLORS[bille.id],                           ((int(bille.x)*ZOOM)+RADIUS,(int(bille.y)*ZOOM)+RADIUS),                           RADIUS,                           WIDTH)    def showall(self,billes):        for bille in billes:            self.show(bille)            def update(self):        pygame.display.update()        self.screen.fill(self.background)        pygame.time.wait(400)