pygame的绘图机制

#Unit PYG05:pygme shape draw test1
import pygame,sys
from math import pi

pygame.init()
screen = pygame.display.set_mode((600,400))
pygame.display.set_caption("Pygame图形绘制")
GOLD = 255,251,0
RED = pygame.Color('red')
WHITE = 255,255,255
GREEN = pygame.Color('green')

#r1rect = pygame.draw.rect(screen,GOLD ,(100,100,200,100),5)   #5为矩形边缘宽度
#r2rect = pygame.draw.rect(screen,RED,(210,210,200,100),0)     #0默认为全填充

e1rect = pygame.draw.ellipse(screen,GREEN,(50,50,500,300),3)   #椭圆形的绘制
c1rect = pygame.draw.circle(screen,GOLD,(200,180),30,5)        #圆形的绘制
c2rect = pygame.draw.circle(screen,GOLD,(400,180),30)          
r1rect = pygame.draw.rect(screen,RED,(170,130,60,10),3)
r2rect = pygame.draw.rect(screen,RED,(370,130,60,10))
plist = [(295,170),(285,250),(260,280),(340,280),(315,250),(305,170)]
al1rect = pygame.draw.aalines(screen,GOLD,True,plist,2)       #连续无锯齿线绘制
#a1rect =pygame.draw.arc(screen,RED,(200,220,200,100),1.4*pi,1.9*pi,3)


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

pygame的绘图机制_第1张图片

你可能感兴趣的:(python的学习)