Python Turtle绘图:重现汤姆劈树的经典瞬间

news2024/11/21 23:30:52

Python Turtle绘图:重现汤姆劈树的经典瞬间

  • 🦀 前言 🦀
  • 🐞往期绘画🐞
  • 🐋 效果图 🐋
  • 🐉 代码 🐉

🦀 前言 🦀

《汤姆与杰瑞》(Tom and Jerry)是我们小时候经常看的一部经典的动画作品。自播出以来就受到了广大观众的喜爱和追捧。它不仅成为了一部经典的动画作品,还衍生出了众多周边产品和续集作品。该动画获得了七项奥斯卡大奖,成为了华纳旗下当之无愧的看家明星。
其中汤姆飞行劈树的画面记忆犹新,让我们使用Python的turtle库来绘画出经典名场面。

🐞往期绘画🐞

序号链接
01🦖用 Python 与 Turtle 创作属于你的“冰墩墩”!🦖
02🦖用 Python 与 Turtle 创作属于你的“雪容融”!🦖
03🦖python梦幻魔法的奥秘:百变小樱魔法阵全解析🦖
04🦖python梦幻魔法的奥秘:魔法少女全解析🦖
05🦖Python Turtle绘图:重现汤姆劈树的经典瞬间🦖
06🐿️Python Turtle召唤童年:喜羊羊与灰太狼之喜羊羊绘画🐿️
07🐿️Python Turtle召唤童年:喜羊羊与灰太狼之懒羊羊绘画🐿️

🐋 效果图 🐋

在这里插入图片描述

🐉 代码 🐉

# 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(723, 540, 100, 80)
turtle.shape('turtle')
turtle.bgcolor((0.45, 0.61, 0.85))
turtle.turtlesize(1.5, 1.5, 1.5)

# 树轮廓
points = [
    (-38, 273), (-36, 264), (-33, 248), (-30, 232), (-27, 215), 
    (-25, 201), (-22, 181), (-16, 152), (-11, 128), (-7, 105), 
    (-4, 88), (0, 67), (8, 32), (15, -3), (19, -22), 
    (21, 42), (30, 104), (39, 155), (49, 196), (55, 227), 
    (63, 255), (68, 273), (150, 274), (147, 260), (139, 223), 
    (124, 173), (107, 122), (106, 114), (102, 107), (94, 61), 
    (87, 23), (83, -3), (80, -35), (79, -62), (77, -92), 
    (80, -155), (79, -206), (78, -244), (80, -275), (-49, -279), 
    (-50, -266), (-50, -258), (-47, -259), (-44, -264), (-47, -259), 
    (-54, -256), (-63, -251), (-74, -245), (-73, -242), (-71, -240), 
    (-72, -236), (-73, -234), (-73, -233), (-71, -233), (-69, -232), 
    (-68, -231), (-67, -228), (-67, -224), (-68, -221), (-69, -219), 
    (-70, -218), (-69, -217), (-67, -216), (-65, -215), (-64, -214), 
    (-64, -212), (-65, -207), (-67, -203), (-69, -199), (-71, -196), 
    (-71, -194), (-69, -194), (-63, -196), (-58, -200), (-51, -206), 
    (-48, -207), (-47, -190), (-47, -168), (-47, -148), (-47, -121), 
    (-47, -100), (-48, -90), (-50, -69), (-52, -43), (-53, -18), 
    (-55, 6), (-59, 33), (-61, 54), (-65, 73), (-68, 93), 
    (-70, 107), (-76, 133), (-77, 141), (-89, 194), (-97, 227), 
    (-105, 257), (-110, 273), 
    ]
plotPoly(points, True, pencolor=(0.19, 0.18, 0.13),
         fillcolor=(0.55, 0.36, 0.27), width=2)

# 树干
points = [
    (-68, 258), (-66, 250), (-65, 243), (-64, 233), (-63, 226), 
    (-63, 221), (-61, 218), (-60, 215), (-60, 211), (-59, 201), 
    (-57, 192), (-55, 176), (-53, 165), (-51, 147), (-49, 137), 
    (-47, 116), (-46, 112), (-45, 109), (-44, 100), (-42, 86), 
    (-40, 70), (-38, 44), (-34, 24), (-31, 8), (-27, -11), 
    (-22, -29), (-17, -47), (-15, -65), (-13, -83), (-12, -104), 
    (-11, -123), (-12, -132), (-11, -161), (-10, -163), (-9, -170), 
    (-9, -192), (-8, -212), (-8, -242), (-8, -264), (-8, -271), 
    (-49, -271), (-48, -268), (-47, -263), (-45, -264), (-42, -265), 
    (-41, -264), (-41, -262), (-45, -259), (-50, -255), (-53, -253), 
    (-56, -252), (-61, -250), (-66, -247), (-70, -245), (-72, -244), 
    (-72, -242), (-70, -242), (-69, -241), (-70, -237), (-70, -234), 
    (-69, -233), (-66, -232), (-66, -229), (-66, -223), (-67, -218), 
    (-66, -216), (-64, -216), (-62, -213), (-63, -211), (-64, -207), 
    (-66, -204), (-66, -201), (-63, -201), (-61, -203), (-59, -206), 
    (-56, -207), (-53, -207), (-49, -209), (-47, -209), (-46, -206), 
    (-45, -184), (-45, -155), (-45, -124), (-45, -95), (-47, -78), 
    (-48, -53), (-50, -34), (-52, -7), (-56, 24), (-59, 49), 
    (-59, 60), (-60, 63), (-64, 77), (-67, 97), (-67, 108), 
    (-71, 121), (-75, 136), (-78, 154), (-82, 173), (-88, 194), 
    (-93, 219), (-98, 238), (-103, 255), (-107, 270), (-109, 272), 
    (-73, 272), (-70, 263), 
    ]
plotPoly(points, True, pencolor=(0.51, 0.33, 0.25),
         fillcolor=(0.47, 0.29, 0.24), width=2)

# 身子
points = [
    (46, 246), (44, 230), (43, 215), (42, 205), (43, 196), 
    (44, 192), (46, 191), (48, 191), (54, 198), (61, 216), 
    (59, 201), (58, 196), (59, 193), (61, 192), (65, 195), 
    (73, 209), (68, 196), (68, 194), (70, 194), (71, 194), 
    (69, 189), (68, 185), (69, 184), (67, 181), (70, 183), 
    (78, 196), (85, 206), (90, 214), (96, 222), (99, 225), 
    (102, 224), (100, 217), (100, 210), (99, 200), (99, 196), 
    (101, 183), (102, 176), (102, 168), (100, 162), (97, 157), 
    (94, 153), (92, 152), (95, 150), (105, 149), (119, 150), 
    (136, 153), (142, 152), (148, 150), (153, 146), (157, 140), 
    (162, 135), (167, 128), (172, 121), (175, 116), (177, 115), 
    (175, 112), (172, 111), (171, 109), (170, 107), (164, 106), 
    (157, 113), (151, 117), (144, 122), (138, 124), (135, 124), 
    (132, 124), (129, 126), (127, 128), (126, 129), (109, 126), 
    (101, 122), (93, 119), (86, 114), (82, 113), (76, 90), 
    (72, 66), (69, 50), (67, 37), (64, 15), (61, -1), 
    (59, -9), (60, -30), (62, -45), (66, -60), (71, -77), 
    (79, -98), (86, -117), (91, -130), (89, -132), (88, -137), 
    (86, -139), (86, -144), (83, -146), (81, -152), (79, -153), 
    (77, -145), (69, -130), (61, -112), (51, -92), (39, -68), 
    (30, -51), (26, -45), (22, -32), (15, -4), (7, 38), 
    (-2, 80), (-4, 88), (2, 99), (8, 113), (12, 120), 
    (15, 125), (19, 126), (17, 129), (10, 131), (3, 137), 
    (-4, 139), (-11, 139), (-13, 139), (-20, 164), (-8, 163), 
    (3, 164), (8, 164), (12, 164), (16, 163), (18, 163), 
    (21, 164), (21, 172), (22, 175), (26, 179), (30, 184), 
    (32, 193), (35, 204), (39, 217), (44, 232), 
    ]
plotPoly(points, True, pencolor=(0.06, 0.12, 0.31),
         fillcolor=(0.34, 0.32, 0.39), width=2)

# 左手
points = [
    (163, 106), (164, 101), (165, 98), (165, 96), (162, 93), 
    (159, 90), (159, 86), (162, 83), (164, 82), (169, 82), 
    (172, 86), (175, 91), (185, 91), (189, 89), (193, 87), 
    (197, 84), (201, 81), (207, 79), (216, 79), (222, 79), 
    (225, 80), (225, 82), (225, 86), (225, 88), (227, 88), 
    (228, 89), (230, 92), (228, 97), (227, 100), (222, 103), 
    (217, 105), (203, 106), (197, 107), (191, 110), (186, 112), 
    (181, 113), (176, 115), (174, 112), (172, 111), (170, 111), 
    (170, 108), (170, 107), (164, 107), 
    ]
plotPoly(points, True, pencolor=(0.06, 0.12, 0.31),
         fillcolor=(0.96, 0.93, 0.95), width=2)

# 左手
points = [
    (187, 95), (179, 95), (175, 95), (174, 93), (174, 89), 
    (173, 87), 
    ]
plotLine(points, pencolor=(0.06, 0.12, 0.11), width=2)

# 左手
points = [
    (206, 89), (214, 80), (217, 79), 
    ]
plotLine(points, pencolor=(0.06, 0.12, 0.11), width=2)

# 
points = [
    (213, 91), (219, 88), (224, 87), 
    ]
plotLine(points, pencolor=(0.09, 0.1, 0.2), width=2)

# 左脚
points = [
    (92, -129), (98, -115), (110, -97), (117, -89), (123, -86), 
    (129, -86), (134, -89), (142, -88), (146, -91), (147, -95), 
    (147, -102), (145, -106), (148, -108), (149, -112), (150, -118), 
    (148, -122), (145, -125), (141, -127), (137, -127), (134, -125), 
    (132, -123), (134, -125), (130, -127), (124, -132), (115, -143), 
    (109, -151), (104, -158), (99, -163), (96, -166), (92, -168), 
    (86, -168), (83, -165), (81, -162), (81, -158), (81, -153), 
    (81, -147), (82, -145), (86, -144), (85, -139), (86, -137), 
    (88, -137), (88, -132), (90, -131), 
    ]
plotPoly(points, True, pencolor=(0.13, 0.13, 0.14),
         fillcolor=(0.96, 0.93, 0.95), width=2)

# 左脚
points = [
    (100, -163), (97, -163), (94, -163), (92, -160), (92, -150), 
    (96, -142), (100, -134), (104, -127), (108, -121), (111, -117), 
    (113, -115), (117, -112), (121, -110), (124, -110), (127, -112), 
    (128, -113), (128, -122), (126, -127), (125, -131), (123, -133), 
    ]
plotLine(points, pencolor=(0.13, 0.13, 0.14), width=2)

# 左脚
points = [
    (118, -106), (121, -109), (124, -109), (128, -107), (131, -104), 
    (133, -99), (134, -95), (133, -91), (132, -88), 
    ]
plotLine(points, pencolor=(0.13, 0.13, 0.14), width=2)

# 左脚
points = [
    (132, -110), (135, -111), (138, -111), (141, -109), (144, -106), 
    (147, -104), 
    ]
plotLine(points, pencolor=(0.13, 0.13, 0.14), width=2)

# 右腿
points = [
    (-52, -46), (-58, -53), (-63, -62), (-71, -73), (-79, -85), 
    (-84, -93), (-85, -96), (-87, -96), (-86, -107), (-85, -118), 
    (-84, -125), (-79, -119), (-71, -109), (-63, -101), (-55, -94), 
    (-49, -90), (-49, -78), (-51, -61), 
    ]
plotPoly(points, True, pencolor=(0.13, 0.13, 0.14),
         fillcolor=(0.34, 0.33, 0.39), width=2)

# 右脚
points = [
    (-113, -45), (-108, -44), (-104, -45), (-100, -48), (-97, -53), 
    (-94, -65), (-90, -80), (-87, -94), (-85, -110), (-85, -125), 
    (-87, -132), (-90, -136), (-92, -137), (-96, -138), (-99, -137), 
    (-102, -135), (-105, -131), (-110, -125), (-116, -112), (-121, -95), 
    (-123, -86), (-125, -80), (-127, -76), (-129, -77), (-135, -77), 
    (-139, -75), (-142, -72), (-143, -67), (-142, -61), (-139, -58), 
    (-137, -57), (-133, -57), (-134, -55), (-133, -52), (-132, -49), 
    (-129, -46), (-125, -44), (-122, -43), (-117, -43), (-114, -44), 
    ]
plotPoly(points, True, pencolor=(0.13, 0.13, 0.14),
         fillcolor=(0.96, 0.93, 0.95), width=2)

# 右脚
points = [
    (-103, -64), (-106, -65), (-109, -65), (-112, -63), (-115, -60), 
    (-117, -56), (-117, -51), (-115, -49), (-114, -47), (-112, -45), 
    ]
plotLine(points, pencolor=(0.13, 0.13, 0.14), width=2)

# 右脚
points = [
    (-122, -64), (-126, -64), (-130, -62), (-132, -59), (-134, -56), 
    ]
plotLine(points, pencolor=(0.13, 0.13, 0.14), width=2)

# 右脚
points = [
    (-124, -83), (-123, -78), (-121, -73), (-119, -71), (-117, -70), 
    (-113, -71), (-111, -73), (-107, -81), (-103, -90), (-100, -101), 
    (-98, -110), (-96, -120), (-95, -126), (-95, -131), (-96, -134), 
    (-97, -136), (-99, -136), (-101, -136), 
    ]
plotLine(points, pencolor=(0.13, 0.13, 0.14), width=2)

# 右手
points = [
    (-76, 133), (-72, 119), (-69, 104), (-71, 103), (-77, 103), 
    (-81, 107), (-83, 108), (-86, 108), (-90, 105), (-93, 104), 
    (-96, 103), (-97, 104), (-98, 105), (-100, 102), (-101, 101), 
    (-103, 99), (-105, 98), (-108, 97), (-111, 96), (-114, 96), 
    (-116, 97), 
    (-117, 95), (-126, 96), (-129, 98), (-131, 100), 
    (-131, 105), (-128, 107), (-123, 112), (-120, 116), (-116, 119), 
    (-117, 121), (-119, 123), (-121, 125), (-126, 126), (-130, 128), 
    (-133, 131), (-133, 134), (-131, 137), (-128, 139), (-124, 140), 
    (-119, 140), (-115, 140), (-111, 139), (-109, 137), (-105, 135), 
    (-104, 133), (-102, 135), (-96, 136), (-90, 136), (-85, 135), 
    (-79, 133), 
    ]
plotPoly(points, True, pencolor=(0.13, 0.13, 0.14),
         fillcolor=(0.96, 0.93, 0.95), width=2)

# 右手
points = [
    (-94, 113), (-96, 108), (-98, 104), 
    ]
plotLine(points, pencolor=(0.13, 0.13, 0.14), width=2)
#plotPoly(points, True, pencolor=(0.13, 0.13, 0.14),
#         fillcolor=(0.96, 0.93, 0.95), width=2)

# 右手
points = [
    (-103, 118), (-109, 115), (-114, 111), (-116, 106), (-118, 102), 
    (-119, 98), 
    ]
plotLine(points, pencolor=(0.13, 0.13, 0.14), width=2)
#plotPoly(points, True, pencolor=(0.13, 0.13, 0.14),
#         fillcolor=(0.96, 0.93, 0.95), width=2)

# 树里面颜色
points = [
    (64, 261), (60, 243), (55, 226), (52, 211), (51, 202), 
    (49, 195), (48, 191), (50, 191), (55, 199), (58, 208), 
    (61, 215), (59, 205), (59, 199), (59, 195), (59, 193), 
    (61, 192), (63, 193), (67, 197), (73, 209), (74, 208), 
    (70, 197), (69, 195), (71, 194), (71, 193), (70, 190), 
    (69, 187), (69, 185), (72, 185), (77, 193), (84, 204), 
    (89, 212), (92, 217), (95, 220), (99, 224), (100, 225), 
    (102, 225), (101, 219), (100, 213), (100, 209), (101, 207), 
    (104, 214), (106, 229), (109, 238), (112, 254), (115, 264), 
    (117, 273), (67, 273), (65, 265), 
    ]
plotPoly(points, True, pencolor=(0.13, 0.13, 0.14),
         fillcolor=(0.88, 0.77, 0.58), width=2)

# 汤姆肚子颜色
points = [
    (-1, 79), (4, 90), (8, 99), (12, 104), (14, 107), 
    (17, 109), (20, 109), (22, 107), (24, 103), (24, 101), 
    (26, 98), (28, 98), (31, 98), (34, 101), (37, 103), 
    (39, 104), (43, 104), (44, 102), (47, 100), (48, 92), 
    (46, 85), (43, 75), (41, 69), (39, 64), (38, 53), 
    (37, 40), (36, 24), (35, 5), (35, -8), (36, -9), 
    (37, -11), (37, -13), (38, -14), (38, -17), (37, -20), 
    (35, -22), (32, -24), (29, -27), (26, -28), (24, -28), 
    (22, -25), (21, -20), (16, 0), (12, 18), (9, 34), 
    (5, 52), (2, 67), 
    ]
plotPoly(points, True, pencolor=(0.59, 0.52, 0.55),
         fillcolor=(0.59, 0.52, 0.55), width=1)

# 
points = [
    (72, 102), (74, 105), (77, 108), (81, 111), 
    ]
plotLine(points, pencolor=(0.11, 0.05, 0.11), width=2)

# 树叶
points = [
    (-65, -213), (-67, -206), (-71, -200), (-75, -194), (-78, -190), 
    (-82, -189), (-84, -188), (-90, -183), (-97, -179), (-105, -176), 
    (-118, -172), (-129, -169), (-138, -167), (-146, -165), (-152, -163), 
    (-159, -157), (-170, -153), (-179, -150), (-192, -146), (-217, -146), 
    (-229, -147), (-252, -148), (-256, -147), (-260, -142), (-266, -138), 
    (-271, -134), (-277, -131), (-289, -127), (-298, -125), (-307, -124), 
    (-328, -124), (-335, -125), (-344, -129), (-350, -131), (-357, -137), 
    (-361, -140), (-362, -145), (-362, -211), (-354, -211), (-353, -213), 
    (-355, -216), (-357, -220), (-358, -223), (-359, -229), (-359, -233), 
    (-356, -237), (-353, -241), (-349, -242), (-341, -242), (-336, -240), 
    (-331, -237), (-326, -233), (-322, -230), (-316, -231), (-314, -233), 
    (-316, -236), (-319, -242), (-321, -245), (-322, -247), (-321, -253), 
    (-317, -257), (-313, -258), (-307, -257), (-301, -254), (-295, -249), 
    (-290, -244), (-287, -240), (-286, -238), (-284, -238), (-282, -242), 
    (-279, -246), (-276, -248), (-272, -248), (-268, -246), (-262, -240), 
    (-257, -234), (-253, -229), (-250, -225), (-244, -225), (-242, -227), 
    (-241, -229), (-242, -232), (-245, -236), (-247, -239), (-247, -242), 
    (-244, -244), (-241, -242), (-238, -240), (-236, -239), (-232, -239), 
    (-233, -242), (-236, -248), (-238, -253), (-239, -259), (-239, -266), 
    (-236, -269), (-235, -271), (-219, -271), (-214, -265), (-208, -258), 
    (-202, -252), (-200, -248), (-199, -246), (-191, -246), (-190, -248), 
    (-192, -250), (-193, -253), (-193, -257), (-192, -262), (-190, -265), 
    (-184, -265), (-182, -265), (-182, -267), (-183, -269), (-183, -271), 
    (-154, -271), (-154, -268), (-154, -265), (-153, -263), (-144, -263), 
    (-141, -261), (-137, -257), (-134, -255), (-132, -254), (-128, -254), 
    (-127, -255), (-126, -255), (-124, -254), (-122, -252), (-120, -250), 
    (-116, -249), (-116, -253), (-116, -255), (-113, -257), (-110, -258), 
    (-107, -256), (-104, -254), (-103, -251), (-102, -251), (-98, -252), 
    (-97, -254), (-95, -255), (-92, -255), (-89, -253), (-86, -250), 
    (-82, -246), (-80, -244), (-75, -244), (-74, -242), (-73, -241), 
    (-72, -241), (-70, -240), (-72, -237), (-73, -235), (-72, -233), 
    (-70, -232), (-68, -231), (-68, -228), (-68, -226), (-67, -225), 
    (-67, -222), (-69, -221), (-69, -219), (-68, -216), (-67, -216), 
    (-65, -214), 
    ]
plotPoly(points, True, pencolor=(0.27, 0.16, 0.13),
         fillcolor=(0.12, 0.15, 0.1), width=2)

# 树叶
points = [
    (-341, -129), (-341, -133), (-341, -137), (-346, -141), (-350, -142), 
    (-354, -145), (-354, -151), (-348, -154), (-346, -157), (-346, -163), 
    (-345, -171), (-346, -177), (-347, -181), (-347, -184), (-342, -188), 
    (-337, -188), (-321, -189), (-313, -189), (-308, -190), (-304, -192), 
    (-303, -195), (-303, -197), (-304, -199), (-301, -203), (-296, -206), 
    (-293, -207), (-285, -204), (-278, -199), (-269, -195), (-265, -192), 
    (-262, -186), (-262, -191), (-262, -194), (-259, -196), (-254, -195), 
    (-249, -193), (-246, -191), (-245, -195), (-244, -200), (-243, -205), 
    (-242, -208), (-234, -207), (-226, -205), (-220, -203), (-216, -200), 
    (-211, -196), (-211, -201), (-212, -206), (-210, -210), (-207, -213), 
    (-203, -215), (-197, -212), (-194, -209), (-185, -210), (-178, -210), 
    (-176, -215), (-175, -219), (-172, -222), (-168, -222), (-166, -221), 
    (-165, -218), (-164, -222), (-163, -225), (-159, -227), (-154, -226), 
    (-152, -222), (-150, -219), (-148, -217), (-144, -216), (-142, -217), 
    (-142, -220), (-141, -224), (-139, -225), (-135, -224), (-131, -223), 
    (-128, -220), (-125, -218), (-122, -218), (-121, -220), (-121, -224), 
    (-119, -226), (-116, -226), (-112, -223), (-107, -217), (-102, -211), 
    (-98, -208), (-93, -207), (-87, -207), (-84, -209), (-81, -212), 
    (-79, -217), (-76, -225), (-74, -228), (-72, -231), (-71, -229), 
    (-70, -225), (-70, -221), (-72, -219), (-72, -217), (-69, -214), 
    (-68, -212), (-68, -209), (-70, -206), (-73, -201), (-76, -195), 
    (-83, -189), (-89, -186), (-97, -181), (-105, -177), (-112, -174), 
    (-122, -172), (-129, -171), (-138, -169), (-147, -167), (-153, -164), 
    (-158, -160), (-162, -158), (-169, -155), (-174, -153), (-183, -150), 
    (-191, -148), (-196, -147), (-203, -147), (-210, -147), (-219, -148), 
    (-228, -149), (-238, -150), (-248, -150), (-252, -151), (-256, -149), 
    (-263, -145), (-267, -140), (-276, -134), (-283, -132), (-293, -129), 
    (-302, -127), (-314, -126), (-322, -125), (-332, -126), 
    ]
plotPoly(points, True, pencolor=(0.18, 0.23, 0.14),
         fillcolor=(0.18, 0.23, 0.14), width=2)

# 树干
points = [
    (-68, 258), (-66, 250), (-65, 243), (-64, 233), (-63, 226), 
    (-63, 221), (-61, 218), (-60, 215), (-60, 211), (-59, 201), 
    (-57, 192), (-55, 176), (-53, 165), (-51, 147), (-49, 137), 
    (-47, 116), (-46, 112), (-45, 109), (-44, 100), (-42, 86), 
    (-40, 70), (-38, 44), (-34, 24), (-31, 8), (-27, -11), 
    (-22, -29), (-17, -47), (-15, -65), (-13, -83), (-12, -104), 
    (-11, -123), (-12, -132), (-11, -161), (-10, -163), (-9, -170), 
    (-9, -192), (-8, -212), (-8, -242), (-8, -264), (-8, -271), 
    (-49, -271), (-48, -268), (-47, -263), (-45, -264), (-42, -265), 
    (-41, -264), (-41, -262), (-45, -259), (-50, -255), (-53, -253), 
    (-56, -252), (-61, -250), (-66, -247), (-70, -245), (-72, -244), 
    (-72, -242), (-70, -242), (-69, -241), (-70, -237), (-70, -234), 
    (-69, -233), (-66, -232), (-66, -229), (-66, -223), (-67, -218), 
    (-66, -216), (-64, -216), (-62, -213), (-63, -211), (-64, -207), 
    (-66, -204), (-66, -201), (-63, -201), (-61, -203), (-59, -206), 
    (-56, -207), (-53, -207), (-49, -209), (-47, -209), (-46, -206), 
    (-45, -184), (-45, -155), (-45, -124), (-45, -95), (-47, -78), 
    (-48, -53), (-50, -34), (-52, -7), (-56, 24), (-59, 49), 
    (-59, 60), (-60, 63), (-64, 77), (-67, 97), (-67, 108), 
    (-71, 121), (-75, 136), (-78, 154), (-82, 173), (-88, 194), 
    (-93, 219), (-98, 238), (-103, 255), (-107, 270), (-109, 272), 
    (-73, 272), (-70, 263), 
    ]
plotPoly(points, True, pencolor=(0.51, 0.33, 0.25),
         fillcolor=(0.47, 0.29, 0.24), width=2)

# 嘴巴周围
points = [
    (31, 149), (27, 150), (20, 150), (18, 149), (15, 147), 
    (14, 146), (13, 144), (12, 143), (12, 140), (13, 137), 
    (15, 133), (19, 126), (22, 123), (25, 120), (28, 118), 
    (31, 116), (33, 115), (36, 115), (43, 115), (47, 115), 
    (50, 116), (54, 117), (57, 119), (61, 122), (64, 126), 
    (67, 131), (68, 135), (68, 139), (67, 142), (65, 145), 
    (62, 144), (54, 144), (52, 146), (49, 147), (45, 148), 
    (42, 148), (41, 147), (40, 146), (38, 148), (37, 149), 
    (35, 149), 
    ]
plotPoly(points, True, pencolor=(0.16, 0.13, 0.21),
         fillcolor=(0.95, 0.95, 0.97), width=2)

# 鼻子
points = [
    (20, 148), (26, 148), (28, 147), (30, 146), (30, 144), 
    (29, 142), (27, 141), (25, 140), (23, 140), (21, 141), 
    (19, 143), (18, 145), (19, 147), 
    ]
plotPoly(points, True, pencolor=(0.01, 0.0, 0.02),
         fillcolor=(0.01, 0.0, 0.02), width=2)

# 嘴巴
points = [
    (16, 138), (18, 136), (21, 135), (22, 136), (23, 135), 
    (25, 134), (29, 134), (29, 136), (30, 134), (36, 133), 
    (42, 134), (44, 137), (46, 138), (47, 139), (49, 140), 
    (51, 140), (52, 139), (53, 137), (53, 135), (52, 133), 
    (50, 132), (49, 131), (47, 131), (46, 132), (43, 133), 
    (42, 134), (39, 134), 
    ]
plotPoly(points, True, pencolor=(0.21, 0.17, 0.21),
         fillcolor=(1.0, 1.0, 1.0), width=2)

# 
points = [
    (45, 126), (47, 125), (49, 124), (52, 125), (55, 126), 
    ]
plotLine(points, pencolor=(0.38, 0.35, 0.41), width=2)

# 
points = [
    (46, 133), (48, 135), (49, 137), (49, 141), 
    ]
plotLine(points, pencolor=(0.53, 0.48, 0.52), width=2)

turtle.up()
turtle.goto((29, 154))
turtle.down()
turtle.pencolor((0.55, 0.5, 0.58))
turtle.dot(5)

# 
points = [
    (40, 151), (41, 153), (43, 153), (45, 153), (46, 152), 
    (46, 151), 
    ]
plotLine(points, pencolor=(0.15, 0.11, 0.17), width=2)

# 
points = [
    (38, 150), (39, 154), (41, 156), (43, 157), (46, 158), 
    (49, 157), (51, 156), (50, 152), (50, 150), (49, 147), 
    ]
plotLine(points, pencolor=(0.17, 0.14, 0.19), width=2)

# 
points = [
    (25, 151), (24, 154), (23, 156), (21, 156), (19, 155), 
    (17, 154), (18, 153), (18, 151), (18, 150), 
    ]
plotLine(points, pencolor=(0.22, 0.18, 0.19), width=2)

# 眉毛
points = [
    (59, 166), (59, 169), (59, 170), (57, 171), (55, 171), 
    (53, 169), (48, 167), (45, 165), (41, 163), (39, 161), 
    (36, 159), (34, 158), (31, 158), (29, 160), (27, 162), 
    (25, 165), (24, 168), (24, 171), (24, 175), 
    ]
plotLine(points, pencolor=(0.01, 0.06, 0.22), width=3)

# 
points = [
    (39, 171), (37, 169), (35, 166), (34, 163), (33, 160), 
    ]
plotLine(points, pencolor=(0.17, 0.15, 0.2), width=2)

# 
points = [
    (28, 163), (30, 165), (31, 167), (31, 169), (32, 171), 
    ]
plotLine(points, pencolor=(0.27, 0.25, 0.28), width=2)

# 头部线条
points = [
    (44, 190), (41, 190), (39, 190), (37, 189), (35, 187), 
    (33, 185), (31, 184), (28, 181), 
    ]
plotLine(points, pencolor=(0.07, 0.13, 0.3), width=2)

# 脸部线条
points = [
    (53, 155), (56, 157), (60, 159), (63, 161), 
    ]
plotLine(points, pencolor=(0.26, 0.24, 0.29), width=2)

# 
points = [
    (51, 148), (54, 149), (58, 151), (64, 155), (69, 158), 
    (74, 163), (81, 168), 
    ]
plotLine(points, pencolor=(0.23, 0.22, 0.3), width=2)

# 
points = [
    (56, 146), (63, 149), (69, 152), (75, 157), (80, 160), 
    ]
plotLine(points, pencolor=(0.25, 0.22, 0.29), width=2)

# 
points = [
    (92, 151), (91, 151), (88, 151), (86, 150), (82, 148), 
    (78, 146), (77, 144), (73, 140), (71, 137), (68, 135), 
    ]
plotLine(points, pencolor=(0.2, 0.21, 0.32), width=2)

# 
points = [
    (61, 122), (60, 120), (59, 118), (58, 114), 
    ]
plotLine(points, pencolor=(0.16, 0.16, 0.21), width=2)

# 
points = [
    (19, 148), (17, 153), (14, 159), (13, 165), 
    (11, 175), (9, 183), (9, 189), (8, 195), 
    ]
plotLine(points, pencolor=(0.16, 0.16, 0.21), width=2)

# 
points = [
    (18, 145), (15, 148), (11, 153), (7, 161), (4, 168), 
    (2, 175), (0, 180), 
    ]
plotLine(points, pencolor=(0.16, 0.16, 0.21), width=2)

# 
points = [
    (52, 155), (51, 152), (51, 149), (52, 145), (55, 145), 
    (59, 145), (63, 146), (68, 147), 
    ]
plotLine(points, pencolor=(0.22, 0.2, 0.27), width=2)

# 左耳
points = [
    (101, 225), (97, 219), (94, 212), (91, 206), (88, 200), 
    (87, 195), (85, 189), (84, 182), (83, 176), (83, 176), 
    (85, 175), (87, 177), (89, 181), (91, 185), (92, 189), 
    (89, 179), (90, 176), (90, 173), (92, 173), (94, 177), 
    (91, 171), (90, 168), (90, 166), (90, 162), (89, 160), 
    (89, 158), (89, 155), (91, 153), (92, 153), (96, 156), 
    (99, 161), (100, 165), (102, 171), (102, 175), (101, 182), 
    (101, 188), (99, 197), (100, 203), (100, 210), (100, 217), 
    ]
plotPoly(points, True, pencolor=(0.2, 0.2, 0.18),
         fillcolor=(0.62, 0.33, 0.35), width=2)

# 右翅膀
points = [
    (-24, 196), (-17, 190), (-11, 186), (-7, 184), (-5, 182), 
    (-5, 180), (-8, 179), (-8, 176), (-6, 172), (-1, 168), 
    (2, 167), (1, 164), (-3, 163), (-7, 163), (-11, 163), 
    (-15, 164), (-18, 165), (-20, 174), (-23, 184), 
    ]
plotPoly(points, True, pencolor=(0.28, 0.21, 0.07),
         fillcolor=(1.0, 1, 1.0), width=2)

# 
points = [
    (-102, 245), (-98, 230), (-93, 213), (-87, 188), (-83, 168), 
    (-78, 147), (-76, 134), (-81, 133), (-84, 135), (-89, 136), 
    (-98, 136), (-102, 135), (-105, 135), (-109, 138), (-111, 139), 
    (-115, 139), (-119, 139), (-120, 139), (-122, 143), (-125, 146), 
    (-129, 149), (-135, 153), (-145, 157), (-155, 160), (-165, 163), 
    (-173, 165), (-177, 167), (-176, 170), (-172, 173), (-172, 177), 
    (-173, 182), (-176, 186), (-183, 195), (-197, 207), (-208, 215), 
    (-220, 223), (-227, 226), (-232, 229), (-234, 233), (-231, 236), 
    (-227, 236), (-223, 240), (-222, 245), (-223, 252), (-225, 260), 
    (-228, 266), (-234, 273), (-111, 276), (-105, 257), 
    ]
plotPoly(points, True, pencolor=(0.29, 0.28, 0.23),
         fillcolor=(1, 1, 1), width=2)

# 
points = [
    (-20, 181), (-16, 181), (-10, 181), (-7, 181), 
    ]
plotLine(points, pencolor=(0.77, 0.6, 0.71), width=2)

# 
points = [
    (-86, 171), (-97, 171), (-112, 170), (-128, 170), (-145, 168), 
    (-164, 167), (-176, 166), 
    ]
plotLine(points, pencolor=(0.77, 0.6, 0.71), width=2)

# 
points = [
    (-96, 217), (-118, 220), (-157, 225), (-182, 229), (-206, 231), 
    (-221, 233), (-225, 236), 
    ]
plotLine(points, pencolor=(0.77, 0.6, 0.71), width=2)

# 左翅膀
points = [
    (93, 153), (94, 150), (100, 149), (113, 150), (121, 152), 
    (133, 153), (142, 153), (148, 151), (152, 149), (157, 143), 
    (162, 136), (168, 127), (174, 118), (176, 114), (179, 114), 
    (181, 114), (184, 113), (189, 120), (196, 125), (203, 131), 
    (212, 139), (225, 147), (239, 154), (252, 159), (262, 164), 
    (272, 167), (270, 168), (267, 170), (264, 172), (265, 175), 
    (268, 181), (275, 189), (283, 195), (291, 201), (300, 207), 
    (309, 211), (318, 216), (326, 220), (330, 223), (329, 225), 
    (326, 226), (322, 226), (319, 227), (319, 232), (321, 239), 
    (326, 247), (332, 255), (337, 262), (342, 268), (345, 271), 
    (179, 273), (170, 267), (165, 262), (159, 257), (153, 253), 
    (152, 252), (153, 247), (153, 241), (153, 236), (151, 230), 
    (148, 226), (145, 222), (143, 220), (139, 216), (135, 212), 
    (131, 209), (123, 205), (117, 203), (119, 199), (120, 194), 
    (117, 188), (113, 182), (108, 177), (106, 174), (103, 172), 
    (101, 171), (103, 169), (104, 167), (103, 164), (101, 161), 
    (99, 158), (97, 156), (94, 154), 
    ]
plotPoly(points, True, pencolor=(0.17, 0.01, 0.03),
         fillcolor=(1, 1, 1), width=2)

# 左翅
points = [
    (103, 170), (120, 170), (148, 170), (176, 168), (204, 168), 
    (242, 168), (270, 167), 
    ]
plotLine(points, pencolor=(0.77, 0.6, 0.71), width=2)

# 左翅
points = [
    (122, 205), (133, 205), (150, 207), (174, 210), (188, 212), 
    (215, 214), (243, 217), (268, 220), (286, 223), (319, 226), 
    ]
plotLine(points, pencolor=(0.77, 0.6, 0.71), width=2)

# 左翅
points = [
    (156, 253), (162, 253), (179, 257), (194, 261), (210, 265), 
    (222, 269), (228, 270), 
    ]
plotLine(points, pencolor=(0.77, 0.6, 0.71), width=2)

# 左翅手环
points = [
    (148, 151), (151, 149), (153, 147), (154, 150), (153, 154), 
    (151, 157), (149, 159), (144, 159), (141, 157), (137, 154), 
    (134, 150), (130, 144), (128, 138), (127, 132), (127, 127), 
    (130, 125), (134, 124), (136, 124), (137, 130), (139, 140), 
    (143, 147), (145, 150), 
    ]
plotPoly(points, True, pencolor=(0.25, 0.28, 0.25),
         fillcolor=(0.82, 0.52, 0.73), width=2)

# 
points = [
    (146, 150), (147, 153), (149, 155), (151, 157), 
    ]
plotLine(points, pencolor=(0.25, 0.28, 0.25), width=2)


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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2244955.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Oracle - 多区间按权重取值逻辑 ,分时区-多层级-取配置方案(二)

Oracle - 多区间按权重取值逻辑 ,分时区-多层级-取配置方案https://blog.csdn.net/shijianduan1/article/details/133386281 某业务配置表,按配置的时间区间及组织层级取方案,形成报表展示出所有部门方案的取值; 例如&#xff0…

DataGear 5.2.0 发布,数据可视化分析平台

DataGear 企业版 1.3.0 已发布,欢迎体验! http://datagear.tech/pro/ DataGear 5.2.0 发布,图表插件支持定义依赖库、严重 BUG 修复、功能改进、安全增强,具体更新内容如下: 重构:各模块管理功能访问路径…

详解八大排序(一)------(插入排序,选择排序,冒泡排序,希尔排序)

文章目录 前言1.插入排序(InsertSort)1.1 核心思路1.2 实现代码 2.选择排序(SelectSort)2.1 核心思路2.2 实现代码 3.冒泡排序(BubbleSort)3.1 核心思路3.2 实现代码 4.希尔排序(ShellSort&…

02 —— Webpack 修改入口和出口

概念 | webpack 中文文档 | webpack中文文档 | webpack中文网 修改入口 webpack.config.js (放在项目根目录下) module.exports {//entry设置入口起点的文件路径entry: ./path/to/my/entry/file.js, }; 修改出口 webpack.config.js const path r…

《InsCode AI IDE:编程新时代的引领者》

《InsCode AI IDE:编程新时代的引领者》 一、InsCode AI IDE 的诞生与亮相二、独特功能与优势(一)智能编程体验(二)多语言支持与功能迭代 三、实际应用与案例(一)游戏开发案例(二&am…

ubuntu 16.04 中 VS2019 跨平台开发环境配置

su 是 “switch user” 的缩写,表示从当前用户切换到另一个用户。 sudo 是 “superuser do” 的缩写,意为“以超级用户身份执行”。 apt 是 “Advanced Package Tool” 的缩写,Ubuntu中用于软件包管理的命令行工具。 1、为 root 用户设置密码…

[Docker#11] 容器编排 | .yml | up | 实验: 部署WordPress

目录 1. 什么是 Docker Compose 生活案例 2. 为什么要使用 Docker Compose Docker Compose 的安装 Docker Compose 的功能 使用步骤 核心功能 Docker Compose 使用场景 Docker Compose 文件(docker-compose.yml) 模仿示例 文件基本结构及常见…

C++时间复杂度与空间复杂度

一、时间复杂度(Time Complexity) 1. 概念 时间复杂度是用来衡量算法运行时间随着输入规模增长而增长的量级。它主要关注的是算法执行基本操作的次数与输入规模之间的关系,而非具体的运行时间(因为实际运行时间会受硬件、编程语…

【Linux】【Shell】Shell 基础与变量

Shell 基础 Shell 基础查看可用的 Shell判断当前 Shell 类型 变量环境变量查看环境变量临时环境变量永久环境变量PATH 变量 自定义变量特殊赋值(双引号、单引号、反撇号) 预定义变量bashrc Shell 基础 Shell 是一个用 C 语言编写的程序,相当于是一个翻译&#xff0c…

【SpringBoot】26 实体映射工具(MapStruct)

Gitee 仓库 https://gitee.com/Lin_DH/system 介绍 现状 为了让应用程序的代码更易于维护,通常会将项目进行分层。在《阿里巴巴 Java 开发手册》中,推荐分层如下图所示: 每层都有对应的领域模型,即不同类型的 Bean。 DO&…

理解和选择Vue的组件风格:组合式API与选项式API详解

目录 前言1. Vue 的两种组件风格概述1.1 选项式 API:直观且分块清晰1.2 组合式 API:灵活且逻辑集中 2. 深入理解组合式 API 的特点2.1 响应式变量与函数式编程2.2 逻辑组织更清晰2.3 更好的代码复用 3. 应用场景分析:如何选择 API 风格3.1 适…

Windows和mac OS共用VMware虚拟机

在Windows下使用VMware Workstation Pro创建的虚拟机,是以文件夹形式存储在硬盘中的,在mac OS中对应的虚拟机产品是VMware Fusion,那么在Windows下创建的虚拟机怎么在mac OS中使用呢? 在下图中我们可以看到,Windows 1…

【K8S系列】Kubernetes Pod节点ImagePullBackOff 状态及解决方案详解【已解决】

在 Kubernetes 中,当某个 Pod 的容器无法从指定的镜像仓库拉取镜像时,Pod 的状态会变为 ImagePullBackOff。这通常是因为指定的镜像不存在、镜像标签错误、认证失败或网络问题等原因。 以下是关于 ImagePullBackOff 的详细分析及解决方案。 1. ImagePullBackOff 状态分析 1.…

04 —— Webpack打包CSS代码

加载器css-loader :解析css代码 webpack 中文文档 | webpack中文文档 | webpack中文网 加载器style-loader:把解析后的css代码插入到DOM style-loader | webpack 中文文档 | webpack中文文档 | webpack中文网 准备css代码,放到src/login目…

单元测试框架gtest学习(二)—— 认识断言

前言 我们在上一篇文章中,简要介绍了gtest是如何使用的 单元测试框架gtest学习(一)——初始gtest-CSDN博客 这篇文章我们主要总结gtest中的所有断言相关的宏。首先需要明确的是,gtest是通过各种断言宏进行测试的,而这…

网安瞭望台第2期:零日漏洞密集爆发、2024年常见网络安全漏洞类型及分析

国内外要闻 Ubuntu 服务器 Needrestart 软件包惊现严重安全漏洞 近日,Ubuntu 服务器(自 21.04 版本起默认安装)的 Needrestart 软件包被曝存在多个可追溯至数十年前的安全漏洞。这些漏洞允许本地攻击者在无需用户交互的情况下获取根…

PDF内容提取,MinerU使用

准备环境 # python 3.10 python3 -m pip install huggingface_hub python3 -m pip install modelscope python3 -m pip install -U magic-pdf[full] --extra-index-url https://wheels.myhloli.com下载需要的模型 import json import osimport requests from huggingface_hub…

【TDOA最小二乘解算】两步最小二乘迭代的TDOA解算方法,适用于二维平面、自适应锚点(附MATLAB代码)

本文所述的MATLAB代码实现了一个基于两步加权最小二乘法的二维目标定位算法,利用多个锚点(基站)和时间差到达(TDOA)数据来估计未知目标的位置。 文章目录 运行结果代码代码功能概述代码结构和详细说明初始化部分参数和…

Comfy UI 工作流(三)高清修复 - 低显存放大

前面提到的几种高清修复、高清放大都会占用,较多的现存。 和 Sd Web UI 中的 SD Upscale 放大一样,Comfy UI 中也提供有类似的自定义节点,通过分块的方式进行图片放大,从而减少现、显存的占用,该方式也经常用于 Com…

形态学图像处理(Morphological Image Processing)

形态学图像处理(Morphological Image Processing) 前言 ‍ 本博客为个人总结数字图像处理一课所写,并给出适当的扩展和相应的demo。 写博客跟做 checkpoint​ 很像,毕竟个人还不能达到那种信手拈来的境界,忘了就是从零开始训练&#xff0…