Python Turtle召唤童年:喜羊羊与灰太狼之懒羊羊绘画

Python Turtle召唤童年:喜羊羊与灰太狼之懒羊羊绘画

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

🐸 前言 🐸

小时候,每次打开电视,看到喜羊羊机智对抗灰太狼的情景,总能让人捧腹大笑,回忆满满。今天,我们用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(680, 680)
# turtle.speed(100)

# 绘画

# 脸部轮廓
points = [
    (-131, 76), (-121, 85), (-112, 94), (-105, 105),
    (-113, 109), (-105, 106), (-97, 106), (-89, 106), (-83, 110), 
    (-77, 115), (-69, 120), (-60, 118), (-53, 117), (-44, 117), 
    (-35, 120), (-26, 126), (-17, 122), (-10, 117), (-3, 114), 
    (6, 111), (16, 110), (26, 112), (32, 115), (36, 117), 
    (42, 112), (47, 107), (53, 102), (61, 98), (71, 96), 
    (80, 96), (89, 97), (98, 99), (104, 92), (108, 86), 
    (114, 78), (121, 71), (128, 66), (139, 62), (138, 53), 
    (138, 42), (139, 32), (143, 25), (149, 17), (154, 9), 
    (157, 6), (154, 2), (152, -1), (147, -5), (143, -12), 
    (140, -20), (138, -28), (137, -38), (139, -46), (139, -52), 
    (132, -57), (124, -63), (120, -70), (115, -76), (113, -86), 
    (109, -96), (100, -103), (94, -111), (90, -119), (89, -125), 
    (90, -131), (94, -137), (97, -142),
    (93, -149), (87, -150), (71, -153), (55, -156), (42, -156), 
    (28, -157), (12, -157), (-2, -155), (-16, -153), (-27, -151), 
    (-37, -147), (-50, -144), (-61, -140), (-71, -137), (-82, -133), 
    (-91, -126), (-102, -119), (-112, -111), (-120, -102), (-127, -94), 
    (-131, -89), (-136, -79), (-139, -71), (-141, -60), (-143, -49), 
    (-141, -38), (-140, -27), (-138, -17), (-135, -8), (-132, 1), 
    (-131, 11), (-132, 22), (-130, 33), (-129, 44), (-126, 55), 
    (-123, 67), (-121, 76), (-121, 85)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         width=2, fillcolor=(1, 0.82, 0.71))

# 左胳膊
points = [
    (93, -147), (97, -143), (102, -138), (111, -134), (119, -131), 
    (130, -128), (143, -126), (149, -120), (158, -117), (166, -113), 
    (175, -110), (177, -103), (182, -95), (191, -89), (199, -87), 
    (204, -85), (210, -86), (214, -88), (217, -93), (221, -96), 
    (224, -100), (224, -104), (223, -108), (225, -112), (226, -118), 
    (224, -124), (219, -128), (215, -129), (210, -127), (205, -123), 
    (208, -118), (203, -114), (203, -110), (209, -109), (213, -105),
    (214, -130),
    (206, -135), (202, -137), (197, -135), (192, -132), (187, -129), 
    (186, -132), (180, -136), (170, -140), (162, -144), (151, -149), 
    (139, -155), (128, -159), (118, -161), (110, -162), (104, -163), 
    (99, -160), (94, -156), (93, -150), (95, -147)
    ]
plotPoly(points, True, pencolor=(1, 0.82, 0.71),
         fillcolor=(1, 0.82, 0.71), width=2)
plotLine(points[:35], pencolor=(0.67, 0.5, 0.22), width=2)
plotLine(points[36:], pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (197, -119), (202, -116), (202, -111), (202, -106), (202, -102), 
    (207, -105), (214, -104), (217, -101), (218, -99), (217, -96), 
    (216, -93), (212, -91), (207, -88), (201, -86)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (223, -111), (219, -114), (215, -117), (210, -117), (205, -117), 
    (203, -114)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)

# 右胳膊
points = [
    (-126, -98), (-133, -94), (-141, -90), (-146, -88), (-151, -85), 
    (-154, -78), (-157, -72), (-162, -68), (-168, -64), (-179, -61), 
    (-184, -59), (-189, -61), (-192, -64), (-196, -69), (-199, -73), 
    (-201, -78), (-199, -85), (-201, -93), (-200, -98), (-196, -102), 
    (-190, -102), (-188, -106), (-184, -108), (-179, -110), (-171, -108), 
    (-163, -103), (-165, -106), (-157, -111), (-149, -116), (-140, -120), 
    (-131, -125), (-118, -133), (-110, -136), (-99, -139), (-97, -136), 
    (-97, -133), (-95, -126), (-98, -123), (-104, -118), (-111, -112), 
    (-119, -103)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(1, 0.82, 0.71), width=2)
points = [
    (-178, -62), (-185, -63), (-193, -67), (-194, -74), (-191, -79), 
    (-186, -79), (-180, -78), (-179, -85), (-179, -88), (-178, -91), 
    (-175, -93)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (-192, -79), (-189, -83), (-185, -85), (-180, -83), (-179, -89), 
    (-183, -93), (-187, -91), (-192, -90), (-198, -86)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (-185, -94), (-181, -97), (-187, -102)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)

# 肚子
points = [
    (-95, -127), (-97, -135), (-96, -142), (-104, -147), (-109, -152), 
    (-112, -156), (-116, -165), (-119, -173), (-121, -182), (-120, -188), 
    (-117, -198), (-114, -208), (-118, -211), (-122, -218), (-123, -228), 
    (-122, -238), (-109, -261), (-103, -266), (-103, -275), (-97, -281), 
    (-91, -289), (-83, -292), (-74, -297), (-64, -299), (-55, -298), 
    (-46, -295), (-40, -301), (-35, -306), (-27, -310), (-16, -312), 
    (-8, -311), (2, -307), (6, -303), (13, -300), (20, -304), 
    (26, -309), (34, -314), (45, -315), (55, -314), (62, -310), 
    (70, -305), (77, -296), (89, -295), (96, -291), (103, -286), 
    (111, -277), (113, -269), (116, -258), (116, -251), (113, -242), 
    (119, -238), (122, -231), (125, -221), (125, -208), (123, -197), 
    (116, -187), (116, -177), (117, -168), (117, -163), (111, -162), 
    (102, -163), (95, -157), (93, -149), (87, -150), (78, -150), 
    (72, -154), (60, -154), (56, -156), (54, -165), (56, -175), 
    (54, -184), (56, -196), (53, -211), (55, -223), (54, -231), 
    (51, -239), (44, -243), (37, -245), (34, -246), (20, -246), 
    (5, -246), (-33, -241), (-56, -237), (-80, -233), (-90, -230), 
    (-94, -227), (-96, -219), (-98, -210), (-95, -201), (-95, -194), 
    (-91, -181), (-88, -163), (-82, -147), (-77, -134), (-86, -131)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(1, 1, 1), width=2)

# 衣服
points = [
    (56, -156), (54, -165), (56, -175), 
    (54, -184), (56, -196), (53, -211), (55, -223), (54, -231), 
    (51, -239), (44, -243), (37, -245), (34, -246), (20, -246), 
    (5, -246), (-33, -241), (-56, -237), (-80, -233), (-90, -230), 
    (-94, -227), (-96, -219), (-98, -210), (-95, -201), (-95, -194), 
    (-91, -181), (-88, -163), (-82, -147), (-77, -134),
    (-71, -138), (-61, -141), (-51, -145), (-40, -147), (-31, -150), 
    (-20, -152), (-9, -155), (1, -156), (12, -157), (22, -157), 
    (34, -158), (46, -156)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(0.97, 0.81, 0.31), width=2)
points = [(-96, -212), (52, -227), (52, -234), (-95, -220)]
plotPoly(points, True, pencolor=(1, 1, 1),
         fillcolor=(1, 1, 1), width=1)
points = [(-91, -228), (45, -240)]
plotLine(points, pencolor=(1, 1, 1), width=2)

# 羊腿(右)
points = [
    (-107, -234), (-106, -237), (-110, -239), (-114, -238), (-120, -238), 
    (-123, -237), (-128, -239), (-134, -240), (-142, -245), (-142, -235), 
    (-144, -231), (-147, -224), (-148, -220), (-151, -215), (-157, -209), 
    (-164, -204), (-171, -204), (-177, -204), (-183, -205), (-188, -206), 
    (-191, -209), (-195, -215), (-198, -219), (-199, -224), (-199, -231), 
    (-199, -237), (-198, -244), (-198, -249), (-195, -257), (-193, -262), 
    (-190, -267), (-186, -274), (-181, -281), (-176, -284), (-172, -285), 
    (-163, -286), (-157, -282), (-152, -278), (-149, -273), (-146, -268), 
    (-139, -264), (-129, -261), (-123, -261), (-111, -259), (-101, -260), 
    (-98, -265), (-98, -260), (-101, -258), (-101, -255), (-102, -254), 
    (-103, -249), (-100, -245), (-104, -241)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(1, 0.82, 0.71), width=2)
points = [
    (-188, -224), (-187, -219), (-186, -215), (-185, -212), (-182, -206)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (-142, -244), (-142, -249), (-143, -256), (-144, -262), (-145, -267)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)

# 羊腿(左)
points = [
    (115, -264), (123, -266), (130, -268), (135, -262), (142, -256), 
    (151, -255), (160, -255), (165, -259), (170, -263), (175, -270), 
    (177, -280), (180, -289), (181, -295), (180, -301), (179, -309), 
    (175, -315), (168, -320), (162, -323), (155, -323), (147, -323), 
    (139, -319), (135, -311), (130, -304), (129, -296), (128, -287), 
    (132, -287), (123, -287), (115, -285), (107, -284)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(1, 0.82, 0.71), width=2)
points = [
    (153, -302), (154, -309), (155, -315), (158, -320), (159, -323)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)

# 头
points = [
    (-139, -80), (-147, -76), (-151, -73), (-156, -68), (-158, -64), 
    (-161, -59), (-164, -53), (-164, -49), (-165, -41), (-165, -36), 
    (-169, -30), (-172, -27), (-176, -17), (-177, -12), (-178, -5), 
    (-179, -1), (-179, 7), (-177, 16), (-175, 25), (-174, 29), 
    (-177, 34), (-179, 41), (-181, 47), (-182, 51), (-183, 59), 
    (-183, 64), (-181, 76), (-180, 81), (-178, 88), (-174, 94), 
    (-169, 100), (-167, 106), (-167, 114), (-167, 123), (-165, 131), 
    (-162, 139), (-161, 144), (-154, 151), (-150, 156), (-147, 160), 
    (-141, 164), (-135, 168), (-132, 170), (-130, 178), (-125, 189), 
    (-122, 195), (-117, 200), (-114, 203), (-103, 212), (-95, 215), 
    (-81, 218), (-72, 218), (-67, 223), (-63, 226), (-55, 234), 
    (-51, 238), (-43, 243), (-36, 246), (-27, 248), (-22, 254), 
    (-20, 261), (-15, 265), (-9, 267), (-1, 270), (5, 276), 
    (13, 283), (22, 284), (29, 288), (37, 288), (43, 287), 
    (50, 291), (50, 293), (59, 297), (67, 299), (76, 302), 
    (83, 306), (90, 312), (92, 318), (100, 314), (103, 311), 
    (109, 307), (115, 300), (120, 293), (123, 283), (123, 278), 
    (131, 274), (140, 271), (148, 264), (152, 256), (153, 247), 
    (152, 242), (160, 240), (165, 233), (171, 224), (182, 217), 
    (187, 213), (192, 207), (195, 202), (199, 195), (200, 189), 
    (207, 187), (216, 183), (224, 179), (264, 118), (271, 112), 
    (277, 103), (280, 93), (280, 85), (282, 77), (282, 68), 
    (279, 60), (279, 54), (279, 44), (284, 36), (286, 27), 
    (286, 13), (289, 3), (286, -8), (283, -15), (279, -23), 
    (275, -30), (269, -36), (271, -42), (272, -50), (269, -57), 
    (268, -65), (267, -69), (265, -75), (263, -80), (258, -85), 
    (254, -91), (249, -94), (242, -102), (235, -106), (223, -111)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (-27, 248), (-24, 242), (-21, 237), (-18, 232), (-13, 229), 
    (-9, 227), (-2, 224)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (1, 269), (6, 265), (11, 258), (16, 253), (24, 249), 
(30, 248), (37, 245), (47, 245)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (45, 286), (46, 280), (48, 275), (53, 271), (62, 267)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (123, 276), (121, 273), (115, 270), (112, 268), (105, 266), 
(98, 266)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (152, 244), (146, 239), (138, 235), (128, 236), (117, 236), 
(104, 237)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)
points = [
    (168, 223), (168, 217), (163, 210), (159, 205), (154, 203), 
(143, 202), (137, 201), (131, 201)
    ]
plotLine(points, pencolor=(0.67, 0.5, 0.22), width=2)

# 羊角(左)
points = [
    (194, 169), (201, 165), (209, 171), (216, 176), (224, 181), 
(231, 184), (244, 188), (258, 192), (271, 194), (281, 194), 
(288, 192), (296, 191), (301, 189), (306, 188), (311, 185), 
(316, 182), (318, 177), (319, 172), (317, 168), (313, 163), 
(311, 160), (310, 158), (306, 153), (300, 151), (293, 148), 
(291, 145), (285, 141), (281, 139), (278, 136), (275, 132), 
(272, 127), (268, 123), (265, 118), (257, 113), (251, 105), 
(254, 102), (257, 96), (254, 102), (251, 106), (245, 109), 
(238, 105), (237, 110), (236, 118), (233, 124), (229, 129), 
(225, 131), (219, 132), (216, 132), (215, 135), (215, 139), 
(216, 148), (215, 150), (214, 154), (209, 160), (205, 162)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(0.51, 0.37, 0.28), width=2)

# 羊角(右)
points = [
    (-119, 201), (-122, 205), (-124, 211), (-128, 216), (-135, 223), 
(-139, 232), (-140, 240), (-141, 249), (-137, 254), (-129, 256), 
(-119, 257), (-110, 256), (-98, 253), (-90, 250), (-81, 246), 
(-74, 242), (-66, 237), (-59, 230), (-62, 225), (-71, 217), 
(-82, 217), (-94, 215), (-104, 211), (-111, 204)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(0.51, 0.37, 0.28), width=2)

# 耳朵(左)
points = [
    (229, 68), (233, 70), (242, 70), (250, 69), (257, 65), 
(263, 58), (269, 51), (274, 44), (278, 38), (282, 31), 
(288, 25), (294, 20), (296, 19), (293, 16), (285, 12), 
(281, 9), (274, 7), (267, 6), (262, 6), (252, 6), 
(241, 9), (234, 12), (228, 18), (221, 29), (217, 40), 
(218, 52), (220, 60), (225, 64)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(1, 0.82, 0.72), width=2)

# 耳朵(右)
points = [
    (-165, 112), (-174, 109), (-179, 106), (-187, 103), (-188, 101), 
(-185, 97), (-182, 91), (-178, 88), (-176, 90), (-174, 92), 
(-167, 99), (-165, 102), (-165, 108)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(1, 0.82, 0.72), width=2)

# 眼睛(右)
turtle.color((0.67, 0.5, 0.22), (1, 1, 1))
turtle.width(2)
turtle.up()
turtle.goto(-71, 8)
turtle.down()
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()

turtle.pencolor((0.1, 0.1, 0.1))
turtle.up()
turtle.goto(-71, 37)
turtle.down()
turtle.dot(25)

turtle.pencolor((1, 1, 1))
turtle.up()
turtle.goto((-74, 41))
turtle.down()
turtle.dot(9)

# 眼睛(左)
turtle.color((0.67, 0.5, 0.22), (1, 1, 1))
turtle.up()
turtle.goto(36, -12)
turtle.down()
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()

turtle.pencolor((0.1, 0.1, 0.1))
turtle.up()
turtle.goto(39, 18)
turtle.down()
turtle.dot(25)

turtle.pencolor((1, 1, 1))
turtle.up()
turtle.goto((34, 22))
turtle.down()
turtle.dot(9)

# 眉毛(左)
points = [
    (-82, 89), (-78, 92), (-74, 95), (-67, 97), (-60, 97), 
(-54, 95), (-48, 93), (-45, 91), (-41, 89), (-38, 86), 
(-35, 83)
    ]
plotLine(points, (0.67, 0.5, 0.22), width=2)

# 眉毛(右)
points = [
    (22, 74), (26, 77), (31, 80), (40, 82), (48, 82), 
(55, 80), (63, 78), (70, 74), (75, 70), (79, 65)
    ]
plotLine(points, (0.67, 0.5, 0.22), width=2)

# 鼻子
points = [
    (-39, 2), (-46, 0), (-52, -2), (-55, -6), (-56, -10), 
(-56, -14), (-55, -17), (-52, -20), (-48, -23), (-44, -25), 
(-40, -26), (-35, -27), (-30, -28), (-24, -27), (-21, -26), 
(-17, -23), (-15, -21), (-14, -17), (-14, -12), (-15, -9), 
(-20, -4), (-22, -3), (-26, -1), (-30, 0), (-33, 1)
    ]
plotPoly(points, True, pencolor=(0.2, 0.14, 0.11),
         fillcolor=(0.2, 0.14, 0.11), width=2)
turtle.pencolor((1, 1, 1))
turtle.up()
turtle.goto((-22, -12))
turtle.down()
turtle.dot(10)

# 嘴巴
points = [
    (-71, -44), (-69, -48), (-63, -53), (-64, -56), (-66, -66), 
(-65, -78), (-65, -87), (-62, -92), (-59, -99), (-56, -103), 
(-50, -106), (-47, -109), (-39, -111), (-29, -111), (-23, -110), 
(-18, -108), (-13, -105), (-10, -102), (-6, -97), (-1, -90), 
(2, -83), (5, -75), (6, -69), (6, -60), (11, -65), 
(7, -61), (5, -58), (3, -53), (5, -58), (2, -58), 
(-5, -60), (-9, -60), (-14, -62), (-20, -62), (-25, -60), 
(-34, -60), (-43, -59), (-52, -57), (-58, -55), (-62, -54), 
(-67, -49)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(0.89, 0.48, 0.43), width=2)
points = [
    (-62, -54), (-60, -55), (-57, -55), (-54, -57), (-49, -58), 
(-47, -60), (-50, -61), (-55, -63), (-59, -67), (-64, -72), 
(-65, -75), (-66, -69), (-65, -60)
    ]
plotPoly(points, True, pencolor=(0.67, 0.5, 0.22),
         fillcolor=(0.63, 0.24, 0.25), width=0)

# 隐藏海龟
turtle.hideturtle()

turtle.done()

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

机器学习问题之一:协变量偏移(Covariate Shift)

协变量偏移(Covariate Shift)是机器学习和深度学习中的一个重要概念,指的是在模型训练和应用时,输入数据(特征)的分布发生了变化,但输出标签的分布保持不变。这会导致模型在训练集上表现良好&am…

【UGUI】Unity 背包系统实现02:道具信息提示与显示

在游戏开发中,背包系统是一个常见的功能模块,用于管理玩家拾取的物品。本文将详细介绍如何在 Unity 中实现一个简单的背包系统,包括道具信息的提示和显示功能。我们将通过代码和场景搭建来逐步实现这一功能。 1. 功能需求清单 在实现背包系…

nodejs入门(1):nodejs的前后端分离

一、引言 我关注nodejs还是从前几年做了的一个电力大数据展示系统开始的,当然,我肯定是很多年的计算机基础的,万变不离其宗。 现在web网站都流行所谓的前后端结构,不知不觉我也开始受到这个影响,以前都是前端直接操作…

go语言闭包捕获的是变量的引用而不是变量的值

在 Go 语言中,闭包捕获的是变量的引用,而不是变量的值。这意味着闭包会引用循环变量或外部变量的实际内存位置,而不是在闭包创建时复制变量的值。这种行为有时会导致意外的结果,尤其是在循环中创建多个闭包时。 闭包捕获变量的引…

记录eslint报错的情况

这几天在调试vue的eslint,害,我领导说eslint要打开规范代码,顺带看了一下eslint的规则,并且研究一下报错。切记每次修改了.eslintrc配置文件,需要重启项目再查看控制台,否则之前的报错会一直存在。 第一个…

Flink错误:一historyserver无法启动,二存在的文件会报错没有那个文件或目录

一.historyserver无法启动 historyserver执行了启动命令后却没有启动,而且也没有报错,如果日志无法启动的话网页8082是无法访问的 只能去查看日志 去flink的log文件查看日志: 发现应该是缺包了,导入jar包后可以解决 &#xff1a…

QT实操中遇到的一些(C++)疑惑点汇总

QT实操中 遇到的一些C疑惑点汇总 1.实例化对象的两种方法及其访问方式 1.1 示例 1.2 总结 2.基类成员的访问 2.1 直接访问继承的基类成员 2.1.1示例代码 2.1.2 输出结果 2.2 使用作用域解析符来显式调用基类成员函数 2.2.1 示例代码 2.2.2 输出结果 2.3 使用 this 指针访问基类…

【运维自动化-作业平台】如何使用全局变量之数组类型?

数组类型的全局变量也是作业平台里常用的,支持关联数组和索引数组,目前仅支持shell,语法跟shell一致。索引数组 语法 arry(1 2 3 a b c) ---定义一个数组arry ${arry[*]} ---获取所有数组元素 ${arry[]} ---获取所有数组元素 ${arry[0]} --…

docker安装zabbix +grafana

安装zabbix grafana 1、部署 mkdir -p /opt/zabbix/{data,backups}mkdir -p /opt/grafanasudo chown -R 472:472 /opt/grafanasudo chmod -R 755 /opt/grafanacat > docker-compose.yml <<-EOF version: 3.3services:mysql-server:image: mysql:8.1container_name: m…

容器安全检测和渗透测试工具

《Java代码审计》http://mp.weixin.qq.com/s?__bizMzkwNjY1Mzc0Nw&mid2247484219&idx1&sn73564e316a4c9794019f15dd6b3ba9f6&chksmc0e47a67f793f371e9f6a4fbc06e7929cb1480b7320fae34c32563307df3a28aca49d1a4addd&scene21#wechat_redirect Docker-bench-…

GB 35114-2017 学习笔记(规避版权阉割版)

GB 35114-2017 学习笔记&#xff08;规避版权阉割版&#xff09; openstd.samr.gov.cn 国家标准全文公开系统 这个政府网站提供GB 35114-2017标准的的预览和下载&#xff0c;有需要的自行下载 GB 35114-2017作为一个国家强制标准&#xff0c;在国家标准全文公开系统 自己做个…

高校企业数据挖掘平台推荐

TipDM数据挖掘建模平台是由广东泰迪智能科技股份有限公司自主研发打造的可视化、一站式、高性能的数据挖掘与人工智能建模服务平台&#xff0c;致力于为使用者打通从数据接入、数据预处理、模型开发训练、模型评估比较、模型应用部署到模型任务调度的全链路。平台内置丰富的机器…

ROSSERIAL与Arduino IDE交叉开发(UBUNTU环境,包含ESP32、arduino nano)

ROSSERIAL与Arduino IDE交叉开发 一、简介二、安装1、Ubuntu下的Arduino IDE安装 **针对ESP32报错问题原因溯源和修改**三、运行结点 一、简介 这个教程展示在ubuntu环境下如何利用Arduino IDE配合rosserial开发机器人部件。通过Arduino IDErosserial实现arduino/esp32开发板通…

word-毕业论文的每一章节的页眉单独设置为该章的题目怎么设置

在Microsoft Word中&#xff0c;为毕业论文的每个章节设置不同的页眉&#xff0c;通常需要使用“分节符”来分隔各个章节&#xff0c;然后在每个章节中单独设置页眉。以下是详细步骤&#xff1a; 使用分节符 插入分节符&#xff1a; 将光标放在每个章节的末尾&#xff08;注意…

Flutter:SlideTransition位移动画,Interval动画延迟

配置vsync&#xff0c;需要实现一下with SingleTickerProviderStateMixinclass _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin{// 定义 AnimationControllerlate AnimationController _controller;overridevoid initState() {super.…

H.265流媒体播放器EasyPlayer.js网页全终端安防视频流媒体播放器可以播放本地视频吗

H.264/H.265播放器EasyPlayer.js主要用于在网页上实现视频播放功能&#xff0c;特别是针对RTSP流的播放。它允许开发者在不需要安装额外插件或软件的情况下&#xff0c;直接在网页中嵌入和播放来自监控摄像头或其他RTSP源的视频流。 可以播放本地视频吗&#xff1f; 回答&…

Linux: 任务的定时与延期

概述 ls 这种命令是立刻执行的命令&#xff0c;在linux中命令还可以延时执行&#xff0c;它们都涉及到时间的观念 常用命令 先来看下有关系统时间的规格 1 &#xff09; date 命令调节时间 $ date 显示当前时间还可以去定制 date 的一个输出, $ man date 可自定义输出 $ d…

RBAC——基于角色的访问控制

目录 一、RBAC核心概念 1. 角色&#xff08;Role&#xff09; 2. 用户&#xff08;User&#xff09; 3. 权限&#xff08;Permission&#xff09; 4. 会话&#xff08;Session&#xff09; 二、RBAC模型的演进 1. RBAC0&#xff1a;基本模型 2. RBAC1&#xff1a;角色…

OceanBase V4.x应用实践:如何排查表被锁问题

DBA在日常工作中常常会面临以下两种常见情况&#xff1a; 业务人员会提出问题&#xff1a;“表被锁了&#xff0c;导致业务受阻&#xff0c;请帮忙解决。” 业务人员还会反馈&#xff1a;“某个程序通常几秒内就能执行完毕&#xff0c;但现在却运行了好几分钟&#xff0c;不清楚…