使用pygame画图
import pygame
if __name__ == '__main__':
pygame.init()
desktop = pygame.display.set_mode((1000,1000))
desktop.fill((255,255,255))
from math import pi
# 猪鼻子
pygame.draw.circle(desktop,(255,40,160),(200,200),50,3)
pygame.draw.circle(desktop, (255, 40, 160), (170, 200), 12, 3)
pygame.draw.circle(desktop, (255, 40, 160), (230, 200), 12, 3)
# 面部
pygame.draw.arc(desktop, (255, 40, 160), (200, 210, 200, 75), pi, 0, 3)
pygame.draw.arc(desktop, (255, 40, 160), (200, 100, 400, 115), 0, pi, 3)
pygame.draw.arc(desktop, (255, 40, 160), (540, 150, 100, 300), 3*pi/2, pi/2, 3)
pygame.draw.arc(desktop, (255, 40, 160), (370, 400, 235, 80), pi, 0, 3)
pygame.draw.arc(desktop, (255, 40, 160), (345, 260, 100, 200), pi/2, 3 * pi / 2, 3)
# 眼睛和嘴
pygame.draw.arc(desktop, (255, 40, 160), (390, 300, 80, 80), pi, 0, 3)
pygame.draw.circle(desktop, (255, 40, 160), (410, 180), 18, 3)
pygame.draw.circle(desktop, (255, 40, 160), (500, 200), 18, 3)
pygame.draw.circle(desktop, (0, 0, 0), (420, 180), 8, 3)
pygame.draw.circle(desktop, (0, 0, 0), (420, 180), 6, 3)
pygame.draw.circle(desktop, (0, 0, 0), (420, 180), 4, 3)
pygame.draw.circle(desktop, (0, 0, 0), (490, 200), 8, 3)
pygame.draw.circle(desktop, (0, 0, 0), (490, 200), 6, 3)
pygame.draw.circle(desktop, (0, 0, 0), (490, 200), 4, 3)
pygame.draw.circle(desktop, (255, 40, 160), (580, 270), 30, 10)
pygame.draw.circle(desktop, (255, 40, 160), (580, 270), 20, 10)
pygame.draw.circle(desktop, (255, 40, 160), (580, 270), 10, 10)
# 耳朵
pygame.draw.arc(desktop, (255, 40, 160), (450, 35, 50, 155), 0, pi, 3)
pygame.draw.arc(desktop, (255, 40, 160), (560, 80, 60, 205), 0, 5*pi/6, 3)
# 身体
pygame.draw.arc(desktop, (0, 0, 255), (250, 300,450,450), 12.5*pi/18, pi/4, 3)
# 脚
pygame.draw.line(desktop, (255, 40, 160), (340, 700), (340, 800), 3)
pygame.draw.line(desktop, (255, 40, 160), (370, 720), (370, 800), 3)
pygame.draw.ellipse(desktop, (255, 40, 160), (300, 800, 100, 40), 3)
pygame.draw.line(desktop, (255, 40, 160), (540, 740), (540, 800), 3)
pygame.draw.line(desktop, (255, 40, 160), (570, 720), (570, 800), 3)
pygame.draw.ellipse(desktop, (255, 40, 160), (500, 800, 100, 40), 3)
# 手
pygame.draw.line(desktop, (255, 40, 160), (250, 500), (120, 450), 3)
pygame.draw.line(desktop, (255, 40, 160), (250, 525), (120, 475), 3)
pygame.draw.circle(desktop, (255, 40, 160), (105, 460), 23, 3)
pygame.draw.line(desktop, (255, 40, 160), (700, 500), (800, 450), 3)
pygame.draw.line(desktop, (255, 40, 160), (700, 525), (800, 475), 3)
pygame.draw.circle(desktop, (255, 40, 160), (820, 460), 23, 3)
# 将内容展示
pygame.display.flip()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
显示结果: