用Python代码画出灰太狼

简介

用python代码画出灰太狼,仅使用turtle库。如下:
在这里插入图片描述

绘画过程可以在下列平台查看:

抖音:用代码画灰太狼,不是一个合格的狼,但一定是合格的丈夫和父亲
b站:用代码画灰太狼,不是一个合格的狼,但一定是合格的丈夫和父亲_哔哩哔哩_bilibili

代码

# coding=gbk

import turtle

def plotLine(points, pencolor=None, width=None, speed=None):
    '''
    功能:画折线
    参数:
    - points : 一系列点,用列表或元组表示
    - pencolor : 画笔颜色,默认不变
    - width : 画笔宽度,默认不变
    - speed : 绘制速度,默认不变
    '''
    # 记录旧参数
    oldpencolor = turtle.pencolor()
    oldwidth = turtle.width()
    oldspeed = turtle.speed()

    # 修改新参数
    if pencolor is not None:
        turtle.pencolor(pencolor)
    if width is not None:
        turtle.width(width)
    if speed is not None:
        turtle.speed(speed)
    
    # 绘制折线
    turtle.up()
    turtle.goto(points[0])
    turtle.down()
    for point in points[1:]:
        turtle.goto(point)
    
    # 恢复旧参数
    turtle.pencolor(oldpencolor)
    turtle.width(oldwidth)
    turtle.speed(oldspeed)


def plotPoly(points, fill=False, pencolor=None, fillcolor=None,
             width=None, speed=None):
    '''
    功能:绘制封闭多边形
    '''
    # 保存旧参数
    oldfillcolor = turtle.fillcolor()

    # 更新新参数
    if fillcolor is not None:
        turtle.fillcolor(fillcolor)

    # 绘制封闭多边形
    points_plotline = list(points) + [points[0]]
    if fill:
        turtle.begin_fill()
        plotLine(points_plotline, pencolor, width, speed)
        turtle.end_fill()
    else:
        plotLine(points_plotline, pencolor, width, speed)

    # 恢复旧参数
    turtle.fillcolor(oldfillcolor)

# 设置一些参数
turtle.setup(700, 579, 100, 30)
turtle.turtlesize(1.5, 1.5, 1.5)
#turtle.speed(5)

# 轮廓
points = [
    (-116, 152), (-132, 159), (-147, 166), (-163, 172), (-183, 179), 
    (-200, 183), (-218, 187), (-242, 192), (-255, 194), (-264, 194), 
    (-272, 195), (-268, 187), (-262, 173), (-258, 163), (-252, 149), 
    (-249, 140), (-243, 127), (-239, 116), (-235, 106), (-230, 94), 
    (-225, 83), (-219, 70), (-215, 58), (-210, 47), (-206, 38), 
    (-203, 31), (-203, 30), (-206, 30), (-214, 24), (-220, 18), 
    (-227, 11), (-234, 4), (-239, -2), (-245, -9), (-250, -17), 
    (-256, -26), (-261, -37), (-266, -47), (-269, -56), (-272, -63), 
    (-275, -73), (-278, -82), (-281, -91), (-274, -91), (-266, -91), 
    (-260, -92), (-251, -95), (-244, -97), (-240, -101), (-239, -105), 
    (-240, -109), (-243, -114), (-247, -118), (-250, -121), (-243, -122), 
    (-232, -124), (-220, -127), (-210, -129), (-200, -132), (-192, -135), 
    (-188, -136), (-186, -137), (-185, -141), (-182, -150), (-179, -160), 
    (-175, -168), (-171, -177), (-165, -186), (-160, -193), (-157, -197), 
    (-152, -203), (-146, -209), (-139, -216), (-132, -221), (-125, -226), 
    (-120, -230), (-121, -238), (-123, -248), (-124, -257), (-124, -264), 
    (-123, -272), (-122, -279), (-121, -286), (-121, -292), (171, -293), 
    (176, -288), (183, -282), (190, -275), (196, -269), (199, -266), 
    (202, -261), (203, -257), (202, -252), (197, -247), (189, -239), 
    (181, -232), (173, -226), (168, -222), (176, -214), (185, -206), 
    (195, -196), (203, -186), (211, -174), (217, -162), (220, -150), 
    (224, -141), (224, -134), (230, -132), (237, -127), (245, -123), 
    (253, -120), (262, -116), (274, -112), (284, -109), (292, -107), 
    (301, -105), (297, -103), (292, -97), (289, -94), (289, -89), 
    (289, -86), (293, -82), (301, -79), (309, -76), (319, -74), 
    (329, -73), (328, -67), (324, -58), (319, -48), (315, -37), 
    (308, -26), (303, -17), (295, -5), (285, 7), (275, 18), 
    (265, 27), (255, 35), (245, 43), (245, 47), (247, 51), 
    (250, 59), (254, 70), (257, 78), (259, 86), (259, 88), 
    (254, 90), (247, 96), (245, 103), (245, 110), (247, 115), 
    (251, 119), (255, 122), (259, 123), (266, 123), (270, 122), 
    (271, 121), (273, 126), (276, 136), (279, 147), (284, 161), 
    (288, 172), (291, 182), (295, 195), (299, 205), (302, 214), 
    (290, 213), (280, 211), (267, 208), (251, 204), (236, 199), 
    (220, 193), (204, 187), (191, 182), (173, 173), (160, 167), 
    (149, 160), (138, 155), (124, 146), (110, 143), (87, 144), 
    (53, 146), (31, 146), (0, 146), (-27, 146), (-54, 145), 
    (-78, 140), (-96, 137), (-104, 145), (-116, 152), 
    ]
plotPoly(points, True, pencolor=(0.03, 0.0, 0.0),
         fillcolor=(0.38, 0.39, 0.38), width=2)

# 帽子
points = [
    (-115, 152), (-122, 145), (-128, 137), (-134, 129), (-139, 120), 
    (-144, 112), (-146, 106), (-146, 100), (-143, 93), (-140, 90), 
    (-134, 86), (-126, 83), (-119, 83), (-104, 83), (-91, 85), 
    (-71, 88), (-51, 92), (-27, 96), (-7, 100), (14, 104), 
    (40, 110), (63, 115), (87, 120), (103, 124), (112, 127), 
    (118, 130), (124, 133), (129, 138), (133, 144), (137, 152), 
    (138, 161), (138, 171), (136, 180), (132, 190), (122, 205), 
    (111, 215), (100, 223), (88, 227), (78, 230), (65, 231), 
    (46, 231), (31, 229), (16, 226), (0, 222), (-9, 219), 
    (-22, 214), (-41, 207), (-55, 200), (-67, 193), (-73, 187), 
    (-83, 181), (-91, 175), (-98, 169), (-107, 160), 
    ]
plotPoly(points, True, pencolor=(0.13, 0.01, 0.0),
         fillcolor=(0.87, 0.4, 0.18), width=1)

# 帽子
points = [
    (-141, 116), (-144, 111), (-145, 106), (-145, 100), (-143, 95), 
    (-138, 90), (-134, 88), (-131, 86), (-127, 85), (-122, 84), 
    (-114, 84), (-107, 84), (-102, 85), (-95, 86), (-86, 87), 
    (-78, 88), (-70, 89), (-63, 90), (-59, 91), (-53, 92), 
    (-46, 93), (-36, 95), (-27, 97), (-15, 99), (-2, 101), 
    (9, 104), (21, 107), (35, 110), (49, 113), (62, 116), 
    (72, 118), (85, 121), (95, 123), (111, 127), (117, 129), 
    (121, 132), (125, 135), (128, 138), (131, 142), (133, 146), 
    (135, 150), (136, 154), (136, 158), (136, 162), (136, 167), 
    (136, 171), (136, 175), (135, 177), (133, 170), (130, 165), 
    (127, 161), (124, 158), (120, 155), (116, 152), (110, 149), 
    (105, 147), (101, 146), (97, 145), (92, 144), (87, 143), 
    (83, 142), (79, 141), (74, 140), (68, 138), (59, 136), 
    (53, 134), (48, 133), (40, 131), (35, 130), (27, 128), 
    (17, 126), (7, 124), (1, 122), (-9, 120), (-16, 118), 
    (-23, 116), (-31, 114), (-40, 112), (-49, 110), (-61, 107), 
    (-66, 106), (-74, 104), (-83, 102), (-91, 101), (-96, 100), 
    (-104, 100), (-114, 100), (-119, 101), (-123, 102), (-127, 104), 
    (-131, 106), (-134, 109), (-136, 111), (-137, 113), (-138, 114), 
    (-139, 116), 
    ]
plotPoly(points, True, pencolor=(0.95, 0.64, 0.55),
         fillcolor=(0.95, 0.64, 0.55), width=1)

# 帽子
points = [
    (-133, 126), (-136, 123), (-138, 120), (-140, 116), (-137, 111), 
    (-134, 108), (-131, 106), (-129, 104), (-127, 103), (-124, 101), 
    (-119, 100), (-112, 100), (-104, 100), (-98, 100), (-89, 101), 
    (-84, 102), (-78, 103), (-69, 105), (-60, 107), (-52, 109), 
    (-43, 111), (-35, 113), (-27, 115), (-20, 117), (-13, 119), 
    (-6, 121), (4, 123), (11, 125), (17, 126), (23, 128), 
    (31, 129), (36, 130), (41, 132), (50, 134), (57, 136), 
    (65, 137), (72, 139), (79, 141), (87, 143), (92, 144), 
    (100, 146), (108, 148), (115, 151), (119, 153), (123, 156), 
    (127, 160), (130, 164), (132, 167), (133, 170), (135, 173), 
    (135, 178), (135, 182), (133, 185), (132, 187), (130, 188), 
    (128, 187), (125, 186), (120, 183), (115, 180), (110, 177), 
    (107, 174), (103, 170), (95, 165), (88, 161), (82, 158), 
    (75, 154), (68, 151), (62, 149), (56, 146), (48, 143), 
    (42, 141), (35, 138), (26, 135), (18, 133), (9, 130), 
    (1, 128), (-9, 125), (-19, 122), (-29, 119), (-38, 117), 
    (-46, 115), (-56, 113), (-64, 111), (-73, 110), (-77, 109), 
    (-83, 108), (-88, 107), (-95, 107), (-106, 107), (-114, 108), 
    (-120, 110), (-124, 111), (-128, 115), (-130, 118), (-132, 122), 
    ]
plotPoly(points, True, pencolor=(0.67, 0.26, 0.09),
         fillcolor=(0.67, 0.26, 0.09), width=2)

# 帽子
points = [
    (14, 226), (8, 220), (2, 215), (-3, 209), (-7, 204), 
    (-12, 200), (-17, 195), (-21, 191), (-16, 192), (-8, 193), 
    (-1, 194), (13, 194), (28, 194), (35, 194), (45, 192), 
    (54, 191), (62, 188), (69, 185), (76, 182), (83, 178), 
    (87, 174), (90, 169), (95, 173), (101, 177), (107, 181), 
    (114, 184), (123, 187), (129, 188), (132, 189), (127, 198), 
    (122, 204), (116, 210), (110, 216), (102, 220), (95, 224), 
    (87, 227), (80, 230), (68, 231), (53, 231), (42, 230), 
    (32, 229), (27, 228), (19, 227), 
    ]
plotPoly(points, True, pencolor=(0.03, 0.09, 0.06),
         fillcolor=(1.0, 0.86, 0.5), width=2)

# 帽子上针线
points = [
    (-5, 214), (3, 215), (11, 215), (15, 216), 
    ]
plotLine(points, pencolor=(0.3, 0.18, 0.0), width=2)

# 
points = [
    (-21, 203), (-11, 204), (1, 205), 
    ]
plotLine(points, pencolor=(0.17, 0.12, 0.0), width=2)

# 
points = [
    (9, 201), (4, 196), (-1, 192), (-6, 188), (-7, 188), 
    ]
plotLine(points, pencolor=(0.4, 0.0, 0.0), width=2)

# 
points = [
    (20, 200), (18, 196), (15, 192), (13, 189), 
    ]
plotLine(points, pencolor=(0.29, 0.0, 0.0), width=2)

# 
points = [
    (36, 200), (34, 195), (31, 191), (30, 187), 
    ]
plotLine(points, pencolor=(0.42, 0.04, 0.0), width=2)

# 
points = [
    (53, 198), (50, 193), (47, 190), (45, 185), 
    ]
plotLine(points, pencolor=(0.6, 0.17, 0.01), width=2)

# 
points = [
    (68, 193), (66, 189), (63, 185), (61, 181), 
    ]
plotLine(points, pencolor=(0.42, 0.02, 0.0), width=2)

# 
points = [
    (83, 189), (81, 184), (79, 179), (76, 172), 
    ]
plotLine(points, pencolor=(0.44, 0.04, 0.0), width=2)

# 
points = [
    (95, 185), (103, 178), (111, 169), 
    ]
plotLine(points, pencolor=(0.41, 0.07, 0.0), width=2)

# 
points = [
    (110, 191), (119, 186), (129, 178), 
    ]
plotLine(points, pencolor=(0.26, 0.1, 0.0), width=2)

# 下巴曲线
points = [
    (-120, -230), (-112, -235), (-105, -239), (-96, -244), (-85, -248), 
    (-75, -252), (-63, -257), (-52, -259), (-40, -262), (-27, -265), 
    (-19, -267), (-9, -268), (3, -269), (17, -270), (30, -270), 
    (48, -268), (62, -266), (70, -265), (76, -264), (85, -262), 
    (90, -261), (99, -258), (112, -254), (121, -250), (130, -246), 
    (138, -241), (147, -237), (153, -233), (159, -228), (164, -224), 
    (170, -220), 
    ]
plotLine(points, pencolor=(0.1, 0.07, 0.03), width=2)

# 围巾
points = [
    (-25, -266), (-19, -269), (-11, -273), (-3, -277), (6, -280), 
    (16, -284), (25, -287), (31, -288), (35, -289), (36, -289), 
    (40, -287), (44, -285), (48, -283), (52, -280), (57, -277), 
    (62, -274), (66, -271), (70, -269), (76, -265), (75, -264), 
    (72, -265), (68, -265), (62, -266), (57, -267), (51, -267), 
    (46, -268), (41, -269), (34, -269), (26, -270), (10, -270), 
    (-1, -269), (-6, -268), (-11, -267), (-16, -267), (-21, -266), 
    ]
plotPoly(points, True, pencolor=(0.05, 0.05, 0.04),
         fillcolor=(0.97, 0.9, 0.63), width=2)

# 右胳膊
points = [
    (-89, -247), (-89, -267), (-89, -271), (-91, -271), (-90, -276), 
    (-90, -281), (-89, -286), (-89, -291), 
    ]
plotLine(points, pencolor=(0.04, 0.04, 0.04), width=2)

# 左胳膊
points = [
    (145, -238), (146, -245), (146, -253), (146, -260), (145, -269), 
    (146, -276), (145, -282), (145, -287), (144, -291), 
    ]
plotLine(points, pencolor=(0.02, 0.02, 0.02), width=2)

# 
points = [
    (146, -248), (149, -248), (152, -251), (156, -255), (162, -260), 
    (156, -264), (152, -268), (148, -271), (146, -271), (146, -258), 
    ]
plotPoly(points, True, pencolor=(0.03, 0.0, 0.0),
         fillcolor=(1, 1, 1), width=2)

# 
points = [
    (177, -246), (173, -250), (169, -253), (164, -258), (160, -261), 
    ]
plotLine(points, pencolor=(0.09, 0.06, 0.03), width=2)

# 右耳
points = [
    (-271, 195), (-266, 181), (-262, 172), (-255, 156), (-250, 142), 
    (-245, 131), (-241, 121), (-236, 110), (-231, 97), (-225, 82), 
    (-218, 65), (-211, 51), (-205, 36), (-204, 32), (-203, 29), 
    (-201, 31), (-200, 34), (-199, 35), (-198, 37), (-195, 36), 
    (-190, 36), (-193, 38), (-196, 41), (-196, 42), (-193, 43), 
    (-181, 43), (-182, 46), (-184, 49), (-185, 50), (-185, 51), 
    (-177, 51), (-170, 50), (-167, 48), (-169, 52), (-173, 59), 
    (-178, 67), (-183, 74), (-189, 84), (-194, 92), (-200, 102), 
    (-206, 110), (-213, 120), (-220, 129), (-228, 140), (-234, 149), 
    (-242, 159), (-248, 167), (-254, 174), (-259, 180), (-263, 185), 
    ]
plotPoly(points, True, pencolor=(0.0, 0.0, 0.01),
         fillcolor=(0.6, 0.6, 0.61), width=2)

# 左耳
points = [
    (301, 214), (296, 208), (289, 197), (281, 186), (274, 176), 
    (266, 163), (259, 152), (251, 139), (243, 126), (235, 112), 
    (227, 96), (220, 82), (214, 72), (209, 63), (209, 61), 
    (213, 62), (217, 64), (226, 65), (226, 63), (222, 59), 
    (223, 58), (236, 58), (239, 57), (237, 55), (233, 51), 
    (233, 50), (242, 51), (243, 49), (244, 48), (246, 47), 
    (250, 57), (254, 72), (259, 84), (259, 86), (259, 88), 
    (254, 89), (250, 93), (247, 96), (245, 101), (244, 105), 
    (245, 110), (246, 114), (250, 118), (254, 121), (258, 123), 
    (264, 124), (268, 123), (271, 122), (273, 129), (276, 138), 
    (280, 150), (283, 160), (286, 169), (291, 182), (294, 193), 
    (298, 202), (300, 208), 
    ]
plotPoly(points, True, pencolor=(0.02, 0.05, 0.06),
         fillcolor=(0.6, 0.6, 0.61), width=2)

# 右眼
points = [
    (-124, 21), (-134, 14), (-142, 5), (-149, -6), (-154, -18), 
    (-156, -29), (-157, -38), (-155, -50), (-150, -65), (-140, -79), 
    (-128, -90), (-113, -98), (-102, -102), (-86, -103), (-71, -102), 
    (-56, -97), (-43, -89), (-30, -78), (-21, -63), (-16, -47), 
    (-15, -34), (-18, -19), (-23, -5), (-30, 5), (-37, 13), 
    (-45, 19), (-54, 23), (-65, 27), (-78, 30), (-92, 30), 
    (-105, 28), (-115, 26), 
    ]
plotPoly(points, True, pencolor=(0.01, 0.01, 0.01),
         fillcolor=(1.0, 1.0, 1.0), width=2)

turtle.up()
turtle.goto((-50, -47))
turtle.down()
turtle.pencolor((0.0, 0.0, 0.01))
turtle.dot(20)

# 左眼
points = [
    (114, 25), (96, 22), (83, 17), (74, 12), (65, 5), 
    (57, -4), (51, -14), (47, -26), (44, -38), (45, -52), 
    (49, -66), (56, -79), (64, -90), (76, -99), (88, -106), 
    (102, -110), (115, -111), (129, -110), (142, -106), (153, -100), 
    (164, -91), (173, -81), (181, -70), (186, -54), (186, -42), 
    (184, -28), (176, -10), (167, 2), (157, 12), (148, 17), 
    (135, 22), (125, 24), 
    ]
plotPoly(points, True, pencolor=(0.04, 0.04, 0.04),
         fillcolor=(0.99, 0.99, 0.99), width=2)

turtle.up()
turtle.goto((143, -50))
turtle.down()
turtle.pencolor((0.01, 0.01, 0.02))
turtle.dot(20)

# 右眉
points = [
    (-146, 66), (-146, 58), (-147, 50), (-147, 42), 
    ]
plotLine(points, pencolor=(0.08, 0.08, 0.08), width=3)

# 右眉
points = [
    (-139, 61), (-140, 54), (-141, 46), (-142, 38), 
    ]
plotLine(points, pencolor=(0.08, 0.08, 0.08), width=3)

# 右眉
points = [
    (-136, 56), (-137, 45), (-138, 36), (-138, 33), (-134, 28), 
    (-129, 25), (-125, 22), (-118, 19), (-111, 16), (-106, 14), 
    (-99, 13), (-88, 12), (-75, 12), (-66, 13), (-58, 15), 
    (-52, 17), (-47, 20), (-41, 22), (-35, 26), (-30, 31), 
    (-25, 36), (-21, 41), (-18, 45), (-17, 47), (-17, 48), 
    (-19, 51), (-21, 54), (-22, 56), (-23, 56), (-27, 53), 
    (-33, 50), (-39, 47), (-45, 44), (-51, 42), (-57, 40), 
    (-62, 39), (-70, 37), (-77, 37), (-87, 37), (-95, 38), 
    (-105, 40), (-112, 42), (-120, 45), (-127, 49), (-131, 51), 
    (-134, 54), 
    ]
plotPoly(points, True, pencolor=(0.0, 0.02, 0.01),
         fillcolor=(0.0, 0.02, 0.01), width=2)

# 左眉
points = [
    (47, 82), (47, 81), (52, 73), (53, 73), (58, 76), 
    (65, 79), (73, 82), (79, 84), (87, 86), (94, 87), 
    (106, 88), (118, 87), (129, 85), (137, 83), (144, 80), 
    (152, 76), (159, 72), (163, 68), (166, 64), (167, 68), 
    (168, 73), (169, 79), (170, 85), (170, 89), (166, 93), 
    (161, 98), (155, 102), (149, 105), (142, 108), (131, 111), 
    (125, 112), (110, 113), (95, 112), (88, 111), (79, 108), 
    (75, 106), (69, 103), (64, 100), (60, 97), (57, 94), 
    (53, 90), (51, 87), (48, 84), 
    ]
plotPoly(points, True, pencolor=(0.0, 0.0, 0.0),
         fillcolor=(0.0, 0.0, 0.0), width=2)

# 左眉
points = [
    (174, 83), (172, 73), (170, 65), (169, 59), 
    ]
plotLine(points, pencolor=(0.04, 0.04, 0.04), width=3)

# 
points = [
    (178, 77), (177, 70), (176, 62), (175, 54), 
    ]
plotLine(points, pencolor=(0.08, 0.08, 0.08), width=3)

# 鼻子
points = [
    (15, -80), (1, -81), (-11, -83), (-18, -85), (-24, -88), 
    (-28, -91), (-32, -96), (-35, -101), (-37, -107), (-36, -115), 
    (-33, -121), (-28, -125), (-21, -129), (-13, -132), (-4, -134), 
    (8, -135), (17, -135), (28, -134), (39, -131), (46, -129), 
    (55, -123), (61, -116), (63, -109), (62, -100), (58, -93), 
    (51, -88), (43, -84), (35, -81), (27, -80), 
    ]
plotPoly(points, True, pencolor=(0.0, 0.0, 0.0),
         fillcolor=(0.0, 0.0, 0.0), width=2)

# 鼻子
points = [
    (-17, -90), (-23, -91), (-27, -93), (-29, -95), (-30, -97), 
    (-31, -99), (-30, -103), (-26, -106), (-22, -108), (-14, -108), 
    (-10, -107), (-7, -105), (-4, -102), (-4, -98), (-5, -95), 
    (-7, -93), (-11, -91), 
    ]
plotPoly(points, True, pencolor=(1.0, 1.0, 1.0),
         fillcolor=(1.0, 1.0, 1.0), width=2)

# 鼻涕
points = [
    (30, -135), (30, -141), (29, -149), (28, -157), (28, -164), 
    (30, -168), (33, -171), (36, -172), (38, -171), (40, -169), 
    (42, -166), (42, -158), (42, -151), (40, -146), (39, -139), 
    (39, -134), (39, -131), (35, -132), (33, -133), 
    ]
plotPoly(points, True, pencolor=(0.17, 0.19, 0.19),
         fillcolor=(0.86, 0.98, 1.0), width=2)

# 嘴巴
points = [
    (-51, -200), (-63, -203), (-71, -206), (-75, -208), (-77, -210), 
    (-77, -213), (-75, -215), (-71, -217), (-66, -218), (-59, -219), 
    (-49, -220), (-38, -220), (-14, -220), (27, -219), (53, -219), 
    (84, -218), (104, -217), (117, -215), (126, -213), (132, -211), 
    (135, -209), (136, -207), (136, -205), (133, -202), (128, -200), 
    (120, -198), (113, -197), (104, -195), (96, -194), (88, -193), 
    (68, -192), (43, -192), (15, -193), (0, -194), (-10, -195), 
    (-23, -196), (-31, -197), (-40, -198), (-44, -199), 
    ]
plotPoly(points, True, pencolor=(0.15, 0.07, 0.05),
         fillcolor=(0.99, 0.69, 0.59), width=2)

# 牙齿
points = [
    (-51, -208), (-57, -217), (-58, -219), (-58, -220), (-52, -221), 
    (-48, -221), (-43, -221), (-43, -220), (-43, -219), (-44, -217), 
    ]
plotPoly(points, True, pencolor=(0.22, 0.06, 0.04),
         fillcolor=(0.99, 0.96, 0.89), width=2)

# 
points = [
    (102, -216), (103, -213), (109, -201), (117, -212), (118, -214), 
    (118, -215), (115, -215), (112, -216), (108, -216), 
    ]
plotPoly(points, True, pencolor=(0.05, 0.04, 0.04),
         fillcolor=(1.0, 0.99, 0.98), width=2)

# 
points = [
    (93, -194), (101, -194), (109, -196), (116, -197), (124, -199), 
    (130, -200), (134, -203), (135, -205), (135, -208), (133, -210), 
    (131, -211), (129, -212), (127, -213), (124, -213), (124, -211), 
    (121, -208), (117, -205), (113, -203), (109, -201), (104, -199), 
    (99, -197), 
    ]
plotPoly(points, True, pencolor=(0.12, 0.05, 0.0),
         fillcolor=(0.33, 0.14, 0.15), width=2)

# 疤痕
points = [
    (-189, -35), (-169, -85), (-158, -114), (-147, -142), (-132, -177), 
    (-124, -199), 
    ]
plotLine(points, pencolor=(0.03, 0.04, 0.04), width=2)

# 疤痕
points = [
    (-158, -62), (-169, -67), (-177, -71), (-183, -75), (-190, -77), 
    ]
plotLine(points, pencolor=(0.03, 0.04, 0.04), width=2)

# 
points = [
    (-153, -90), (-164, -96), (-173, -101), (-179, -104), 
    ]
plotLine(points, pencolor=(0.02, 0.02, 0.02), width=2)

# 疤痕
points = [
    (-147, -113), (-172, -126), 
    ]
plotLine(points, pencolor=(0.03, 0.04, 0.04), width=2)

# 
points = [
    (-140, -133), (-148, -138), (-157, -143), 
    ]
plotLine(points, pencolor=(0.04, 0.04, 0.04), width=2)

# 
points = [
    (-129, -159), (-141, -164), (-154, -169), 
    ]
plotLine(points, pencolor=(0.0, 0.0, 0.01), width=2)

# 
points = [
    (-126, -176), (-138, -181), 
    ]
plotLine(points, pencolor=(0.06, 0.06, 0.06), width=2)

# 胡子
points = [
    (-146, -191), (-157, -197), (-170, -203), (-189, -211), 
    ]
plotLine(points, pencolor=(0.03, 0.04, 0.04), width=2)

# 胡子
points = [
    (-121, -217), (-126, -224), (-132, -227), (-138, -229), (-148, -229), 
    ]
plotLine(points, pencolor=(0.03, 0.04, 0.04), width=2)

# 
points = [
    (-96, -237), (-100, -242), (-104, -247), (-110, -252), 
    ]
plotLine(points, pencolor=(0.0, 0.0, 0.0), width=2)

# 
points = [
    (-55, -248), (-56, -251), (-58, -257), (-60, -263), (-61, -270), 
    (-62, -276), (-62, -280), 
    ]
plotLine(points, pencolor=(0.05, 0.05, 0.05), width=2)

# 
points = [
    (-20, -259), (-20, -265), (-21, -269), (-21, -276), (-21, -288), 
    (-21, -291), 
    ]
plotLine(points, pencolor=(0.02, 0.02, 0.04), width=2)

# 
points = [
    (37, -259), (37, -268), (38, -276), (38, -279), 
    ]
plotLine(points, pencolor=(0.0, 0.0, 0.0), width=2)

# 
points = [
    (55, -264), (58, -270), (59, -275), (59, -279), 
    ]
plotLine(points, pencolor=(0.0, 0.0, 0.0), width=2)

# 
points = [
    (75, -244), (80, -253), (86, -264), (92, -274), (99, -286), 
    ]
plotLine(points, pencolor=(0.04, 0.04, 0.04), width=2)

# 
points = [
    (107, -246), (108, -256), (109, -264), 
    ]
plotLine(points, pencolor=(0.02, 0.02, 0.04), width=2)

# 
points = [
    (142, -228), (150, -236), (157, -244), (159, -251), 
    ]
plotLine(points, pencolor=(0.02, 0.02, 0.04), width=2)

# 
points = [
    (163, -217), (167, -221), (170, -225), (172, -231), 
    ]
plotLine(points, pencolor=(0.02, 0.02, 0.04), width=2)

# 
points = [
    (179, -196), (188, -201), (196, -206), (206, -212), 
    ]
plotLine(points, pencolor=(0.02, 0.02, 0.04), width=2)

# 
points = [
    (198, -161), (208, -175), (215, -183), (220, -189), (227, -198), 
    (232, -203), 
    ]
plotLine(points, pencolor=(0.02, 0.02, 0.04), width=2)


# 隐藏海龟
turtle.hideturtle()
turtle.done()

运行效果

在这里插入图片描述

备注

视频已发布到抖音和 b 站。抖音和b站名称:会代码的依古比古

抖音视频网址:用代码画灰太狼,不是一个合格的狼,但一定是合格的丈夫和父亲

b站视频网址:用代码画灰太狼,不是一个合格的狼,但一定是合格的丈夫和父亲_哔哩哔哩_bilibili

  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值