赞
踩
import pygame import sys from pygame.locals import * import math pygame.init() WHITE = (255,255,255) BLACK = (0,0,0) size = width,height = 640,480 screen = pygame.display.set_mode(size) clock = pygame.time.Clock() moving = False while True: for event in pygame.event.get(): if event.type == QUIT: sys.exit() screen.fill(WHITE) #矩形 pygame.draw.rect(screen,BLACK,(50,50,100,50),1) #0填充 #多边形 pygame.draw.polygon(screen,BLACK,[(200,200),(100,300),(300,300)],1) #圆形 pygame.draw.circle(screen,BLACK,(400,400),75,1) #椭圆形 pygame.draw.ellipse(screen,BLACK,(100,100,400,100),1) #弧线 pygame.draw.arc(screen,BLACK,(200,50,300,100),math.pi,math.pi*2,1) #线段 pygame.draw.line(screen,BLACK,(20,20),(20,100),1) pygame.draw.aaline(screen,BLACK,(30,30),(400,800),0) #抗锯齿 0 pygame.display.flip() clock.tick(10) #1s10次
运行结果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。