domingo, 8 de marzo de 2015

Dibujo de figuras

import pygame, random, sys
from pygame.locals import *
pygame.init()
disp=pygame.display.set_mode((500,500),0,32)
Black = (0,0,0)
White = (255,255,255)
Red = (255,0,0)
Green = (0,255,0)
Blue = (0,0,255)

disp.fill(White)
pygame.draw.line(disp,Blue,(0,0),(100,100),4)
pygame.draw.polygon(disp,Green,
            ((10,0),(30,40),(50,80),(80,30)))
pygame.draw.lines(disp,Green,True,
            ((10,100),(330,40),(250,80),(80,230)),4)

pygame.draw.circle(disp,Blue,(200,200),50,2)
pygame.draw.circle(disp,Blue,(200,200),random.randint(2,4)*50,2)
pygame.draw.circle(disp,Blue,(200,300),50,2)
pygame.draw.ellipse(disp,Blue,(200,200,30,60),1)
pygame.draw.rect(disp,Red,(200,210,400,420))
pygame.draw.circle(disp,Blue,(250,400),50,2)
pixObj = pygame.PixelArray(disp)
for i in range(100):
    pixObj[80][i+1] = Black
del pixObj

while True:
     for event in pygame.event.get():
         if event.type == QUIT:
             pygame.quit()
             sys.exit()
     pygame.display.update()

No hay comentarios:

Publicar un comentario