Pygame(四)画椭圆,弧
前情提要:
作业答案
- 正方形与内切圆
def rect_circle():
pygame.init()
screen = pygame.display.set_mode((800, 600))
screen.fill((255,255,255))
# 画正方形
rect = pygame.Rect(300, 200, 200, 200)
pygame.draw.rect(screen, (0, 0, 255), rect, width = 1)
# 画内切圆, 半径因为正方形的线宽占了一个,所以半径要相应的少一个
pos = 400, 300
radius = 99
pygame.draw.circle(screen, (255, 0, 0), pos, radius, )
pygame.display.update()
while 1:
for event in pygame.event.get(