import pygame

# 初始化
pygame.init()
WIDTH, HEIGHT = 600, 400
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("简易绘制‑火柴人")
clock = pygame.time.Clock()

# 颜色
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)

running = True
while running:
    screen.fill(WHITE)

    # 坐标基准（火柴人躯干中心点）
    cx, cy = 300, 180
    head_r = 25

    # 头部圆形
    pygame.draw.circle(screen, BLACK, (cx, cy - 60), head_r, 3)
    # 眼睛
    pygame.draw.circle(screen, BLACK, (cx - 10, cy - 65), 4)
    pygame.draw.circle(screen, BLACK, (cx + 10, cy - 65), 4)
    # 嘴巴弧线
    pygame.draw.arc(screen, BLACK, [cx-8, cy-48, 16, 10], 0.2, 2.9, 2)

    # 躯干
    pygame.draw.line(screen, BLACK, (cx, cy - 35), (cx, cy + 40), 3)

    # 双臂
    pygame.draw.line(screen, BLACK, (cx, cy - 20), (cx - 55, cy + 5), 3)
    pygame.draw.line(screen, BLACK, (cx, cy - 20), (cx + 55, cy - 8), 3)

    # 双腿
    pygame.draw.line(screen, BLACK, (cx, cy + 40), (cx - 40, cy + 110), 3)
    pygame.draw.line(screen, BLACK, (cx, cy + 40), (cx + 35, cy + 115), 3)

    # 事件监听
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    pygame.display.flip()
    clock.tick(60)

pygame.quit()