人物肖像

import pygame
from math import pi
def circle(address,x,y,num):
    # pygame.draw.circle(address,(255,0,0) ,(x,y),100,2)
    # 脖子
    pygame.draw.rect(address,(250,235,215),(x+25,y+112,50,50),0)
   #头部
    pygame.draw.ellipse(address,(0,0,0),(x-3,y,106,140),0)
    pygame.draw.circle(address,(245,222,179),(x+50,y+14+50),50,0)
    pygame.draw.ellipse(address,(245,222,179),(x-2, y+17, 104, 133),0)
    # pygame.draw.ellipse(address, (240,230,140), (x, y, width, height/2), 0)
    # pygame.draw.ellipse(address, (240,230,140), (x, y-54, width, height+100),0)
    pygame.draw.ellipse(address, (0, 0, 0),(x + 9, y + 45, 33, 21), 0)
    pygame.draw.ellipse(address, (0, 0, 0),(x + 57, y + 45, 33, 21), 0)
    pygame.draw.ellipse(address, (245,222,179),(x + 8, y + 48, 33, 21), 0)
    pygame.draw.ellipse(address, (245,222,179),(x + 58 , y + 48, 33, 21), 0)
    pygame.draw.ellipse(address, (255,255,255), (x+8, y+50, 33, 20), 0)
    pygame.draw.ellipse(address, (255,255,255), (x + 58, y+50, 33, 20), 0)
    # 眼珠
    pygame.draw.circle(address, (0,0,0), (x + 27, y + 58), 9, 0)
    pygame.draw.circle(address, (0,0,0), (x + 71, y + 58), 9, 0)
    # pygame.draw.circle(address,(0,191,255) ,(x+25,y+62),4,0)
    # pygame.draw.circle(address, (0,191,255), (x + 75, y+62), 4, 0)
    pygame.draw.arc(address,(55,55,55),(x+1,y+50,50,50),7*pi/4,2*pi,1)
    pygame.draw.circle(address, (55,55,55), (x+47,y+97),7 ,1)
    pygame.draw.circle(address, (245,222,179),(x + 50, y + 97), 8, 0)
    pygame.draw.circle(address, (245,222,179),(x + 50, y + 98), 8, 0)
    pygame.draw.ellipse(address, (240,128,128),(x+30,y+112,33,12),0)
    pygame.draw.ellipse(address, (255, 255, 255),(x+33,y+ 117,27,5),0)
    # 身体

    pygame.draw.ellipse(address, (255,255,255),(x-50,y+160,200,100),0)
    pygame.draw.ellipse(address, (255, 255, 255), (x - 50, y + 167, 200, 100), 0)
    pygame.draw.ellipse(address, (250,235,215), (x+14, y + 150, 70, 35), 0)
    # 大腿
    pygame.draw.ellipse(address, (  85,107,47), (x-36, y+260, 170, 380), 0)#脚
    pygame.draw.ellipse(address, (85, 107, 47), (x - 31, y + 290, 160, 380), 0)  # 脚
    pygame.draw.ellipse(address, (85, 107, 47), (x - 26, y + 320, 150, 380), 0)  # 脚
    pygame.draw.rect(address,(255,255,255),(x-35,y+210,170,150),0)

    # 背着手
    pygame.draw.line(address,(245,245,245),(x - 35,y + 210),(x - 35,y + 243),2)
    pygame.draw.line(address, (245,245,245), (x +135, y + 210), (x +135, y + 243),2)
    #过度到脚
    pygame.draw.ellipse(address, (255,255,255), (x - 40, y + 340, 20, 40), 0)
    pygame.draw.ellipse(address, (255,255,255), (x+120, y + 340, 20, 40), 0)
    # 腿
    pygame.draw.rect(address, (255, 255, 255), (x - 30, y + 360, 160, 20), 0)
    pygame.draw.rect(address, (0, 255, 0), (x - 26, y + 650, 200, 150), 0)
    # 脚
    # 左脚
    if num%2==0: # 偶数
        pygame.draw.ellipse(address, (0, 0, 0), (x+3, y + 640, 35, 60), 0)
    else:  # 奇数
        pygame.draw.rect(address, (0, 255, 0), (x-10, y + 630, 60, 20), 0)
        pygame.draw.ellipse(address, (0, 0, 0), (x + 3, y + 626, 35, 60), 0)
    # 右脚 偶数
    if num%2==0:
        pygame.draw.rect(address, (0, 255,0), (x + 54, y + 630, 60, 20), 0)
        pygame.draw.ellipse(address, (0, 0, 0), (x + 61, y + 626, 35, 60), 0)
    # 静止下 奇数
    else:
        pygame.draw.ellipse(address, (0, 0, 0), (x + 61, y + 640, 35, 60), 0)
    # pygame.draw.rect(address, (0, 255, 0), (x +47, y + 400, 6, 250), 0)
    pygame.draw.ellipse(address, (0, 255,0), (x +45, y + 400,10, 500), 0)
    # 脚板上
    # 左脚
    #  偶数
    if num%2==0:
        pygame.draw.rect(address,(245,222,179),(x+8, y + 650,25,5),0)
        pygame.draw.ellipse(address, (245, 222, 179), (x + 8, y + 644, 25, 20), 0)
        pygame.draw.rect(address, (85, 107, 47), (x + 3, y + 640, 30, 10), 0)
    else:
        pygame.draw.rect(address, (245, 222, 179), (x + 8, y + 630, 25, 5), 0)
        pygame.draw.ellipse(address, (245, 222, 179), (x + 8, y + 624, 25, 20), 0)
        pygame.draw.rect(address, (85, 107, 47), (x + 3, y + 620, 30, 10), 0)
    # 右脚
    if num%2==0: #偶数
        pygame.draw.rect(address, (245, 222, 179), (x + 66, y + 630, 25, 5), 0)
        pygame.draw.ellipse(address, (245, 222, 179), (x + 66, y + 624, 25, 20), 0)
        pygame.draw.rect(address, (85, 107, 47), (x + 61, y + 620, 30, 10), 0)
    else: # 奇数
        pygame.draw.rect(address, (245, 222, 179), (x + 66, y + 650, 25, 5), 0)
        pygame.draw.ellipse(address, (245, 222, 179), (x + 66, y + 644, 25, 20), 0)
        pygame.draw.rect(address, (85, 107, 47), (x + 61, y + 640, 30, 10), 0)


if __name__ == '__main__':
    pygame.init()
    screen=pygame.display.set_mode((800,1200))
    screen.fill((0,255,0))
    # circle(screen, 300, 10,1)
    # screen.blit()
    pygame.display.flip()
    num=0
    while True:
        num+=1
        for event in pygame.event.get():
            if event.type==pygame.QUIT:
                exit()
        # pygame.time.get_ticks('10')
        pygame.time.wait(5000)
        circle(screen, 100+num, 10, num)

结果:


1.GIF

你可能感兴趣的:(人物肖像)