• 當前位置:首頁 > IT技術 > 微信平臺 > 正文

    【Python小程序】紅紅火火過大年,(代碼)巧手編織中國結,分分鐘那驚艷你哦~
    2022-02-14 14:12:52


    導語

    春節是中國特有的傳統節日,中國結是中華民族特有的純粹的文化精髓,富含豐富的文化底

    蘊,代表著我們對未來,對美好生活的向往和憧憬。新春佳節,小編祝福大家虎年吉祥!萬事

    如意!祝我們的祖國引領世界,勇立潮頭!國富民強!

    【Python小程序】紅紅火火過大年,(代碼)巧手編織中國結,分分鐘那驚艷你哦~_Turtle

    漸漸的,漸漸的,新年很快就要到來。在快過新年時,人們有一個習俗,那就是買“中國結”。

    據說,中國結可以讓一家人平平安安、幸福,所以,中國結就一直為人們喜愛。

    中國結制作十分精巧、巧妙,令人嘆為觀止。今天小編用代碼給大家編制拜年禮物????繪制多種

    《中國結合集》啦~

    【Python小程序】紅紅火火過大年,(代碼)巧手編織中國結,分分鐘那驚艷你哦~_小程序_02

    正文

    一、中國結 01? 平安喜樂

    1)你的2022一定很哇塞i

    【Python小程序】紅紅火火過大年,(代碼)巧手編織中國結,分分鐘那驚艷你哦~_Turtle_03

    2)附代碼

    import turtle
    turtle.screensize(600,800)
    turtle.pensize(10)
    turtle.pencolor("red")
    turtle.seth(-45)
    turtle.fd(102)
    turtle.circle(-6,180)
    turtle.fd(102)
    turtle.circle(6,180)
    turtle.fd(102)
    turtle.circle(-6,180)
    turtle.fd(102)
    turtle.circle(6,180)
    turtle.fd(102)
    turtle.circle(-6,180)
    turtle.fd(102)
    turtle.circle(6,180)
    turtle.fd(92)
    turtle.circle(-6,270)
    turtle.fd(92)
    turtle.circle(6,180)
    turtle.fd(102)
    turtle.circle(-6,180)
    turtle.fd(102)
    turtle.circle(6,180)
    turtle.fd(102)
    turtle.circle(-6,180)
    turtle.fd(102)
    turtle.circle(6,180)
    turtle.fd(102)
    turtle.circle(-6,180)
    turtle.fd(88)
    turtle.fd(20)
    turtle.seth(135)
    turtle.fd(20)
    turtle.seth(225)
    turtle.fd(20)
    turtle.seth(315)
    turtle.fd(20)
    turtle.seth(45)
    turtle.fd(20)
    turtle.seth(135)
    turtle.begin_fill()
    turtle.fillcolor("red")
    turtle.fd(50)
    turtle.seth(45)
    turtle.fd(30)
    turtle.seth(-45)
    turtle.fd(30)
    turtle.seth(225)
    turtle.fd(30)
    turtle.end_fill()
    turtle.seth(90)
    turtle.fd(40)
    turtle.pensize(20)
    turtle.fd(10)
    turtle.pensize(5)
    turtle.seth(105)
    turtle.fd(30)
    turtle.circle(-8,240)
    turtle.circle(20,20)
    turtle.fd(5)
    turtle.circle(20,60)
    turtle.fd(25)
    turtle.penup()
    turtle.setx(0)
    turtle.sety(0)
    turtle.goto(2,-127)
    turtle.pendown()
    turtle.pensize(5)
    turtle.begin_fill()
    turtle.fillcolor("red")
    turtle.seth(0)
    turtle.fd(15)
    turtle.seth(-90)
    turtle.fd(10)
    turtle.seth(180)
    turtle.fd(15)
    turtle.seth(90)
    turtle.fd(10)
    turtle.seth(0)
    turtle.fd(15)
    turtle.end_fill()
    turtle.pensize(2)
    for x in range(6):
    turtle.seth(-90)
    turtle.fd(50)
    turtle.penup()
    turtle.seth(90)
    turtle.fd(50)
    turtle.seth(180)
    turtle.fd(3)
    turtle.pendown()

    二、中國結 02 心想事成

    1)祝你新的一年好運爆棚,愿望統統實現。

    【Python小程序】紅紅火火過大年,(代碼)巧手編織中國結,分分鐘那驚艷你哦~_小程序_04

    2)附代碼

    import turtle as t
    def goto(x,y):
    t.penup()
    t.goto(x,y)
    t.pendown()

    def init():
    t.setup(800,800)
    t.pensize(10)
    t.pencolor("red")
    t.speed(14)

    def jiexin():
    m,n=0,200
    for i in range(11):
    goto(m,n)
    t.seth(-45)
    t.fd(200)
    m-=20/pow(2,0.5)
    n-=20/pow(2,0.5)

    m,n=0,200
    for j in range(11):
    goto(m,n)
    t.seth(-135)
    t.fd(200)
    m+=20/pow(2,0.5)
    n-=20/pow(2,0.5)

    def jiexiaoban():
    m=-20/pow(2,0.5)
    n=200-20/pow(2,0.5)
    for k in range(4):
    goto(m,n)
    t.seth(135)
    t.fd(20)
    t.circle(10,180)
    t.fd(20)
    m-=40/pow(2,0.5)
    n-=40/pow(2,0.5)

    m=20/pow(2,0.5)
    n=200-20/pow(2,0.5)
    for k in range(4):
    goto(m,n)
    t.seth(45)
    t.fd(20)
    t.circle(-10,180)
    t.fd(20)
    m+=40/pow(2,0.5)
    n-=40/pow(2,0.5)

    m=20/pow(2,0.5)
    n=200-200*pow(2,0.5)+20/pow(2,0.5)
    for k in range(4):
    goto(m,n)
    t.seth(-45)
    t.fd(20)
    t.circle(10,180)
    t.fd(20)
    m+=40/pow(2,0.5)
    n+=40/pow(2,0.5)

    m=-20/pow(2,0.5)
    n=200-200*pow(2,0.5)+20/pow(2,0.5)
    for k in range(4):
    goto(m,n)
    t.seth(-135)
    t.fd(20)
    t.circle(-10,180)
    t.fd(20)
    m-=40/pow(2,0.5)
    n+=40/pow(2,0.5)

    def waiyuan():
    goto(90*pow(2,0.5),200-110*pow(2,0.5))
    t.seth(-45)
    t.circle(20,270)

    goto(-90*pow(2,0.5),200-110*pow(2,0.5))
    t.seth(-135)
    t.circle(-20,270)

    goto(80*pow(2,0.5),200-120*pow(2,0.5))
    t.seth(-45)
    t.circle(40,270)

    goto(-80*pow(2,0.5),200-120*pow(2,0.5))
    t.seth(-135)
    t.circle(-40,270)

    def shengzi():
    goto(0,200)
    t.pensize(20)
    t.seth(90)
    t.fd(60)
    goto(0,320)
    t.pensize(12)
    t.seth(180)
    t.circle(30,360)

    goto(0,200-200*pow(2,0.5))
    t.pensize(40)
    t.seth(-90)
    t.fd(20)
    t.pensize(2)
    s=-20
    for i in range(11):
    goto(s,200-200*pow(2,0.5))
    t.seth(-90)
    t.fd(200)
    s+=4

    def hanzi():
    goto(-150,325)
    t.write("幸福中國結",font=("Arial",40,"normal"))

    def main():
    init()
    jiexin()
    jiexiaoban()
    waiyuan()
    shengzi()
    hanzi()
    t.hideturtle()

    三、中國結 03?煙火年年

    辭慕爾爾,煙火年年,前程似錦,順遂康安。

    【Python小程序】紅紅火火過大年,(代碼)巧手編織中國結,分分鐘那驚艷你哦~_新年_05

    總結

    最后祝大家:大吉大利,平安喜樂,錦鯉附體,好事發生,發個大財,心想事成!

    完整的源碼見文末哈自取啦~(往期的也大部分都有源碼滴可以找我免費拿撒)

    完整的素材、安裝環境、源碼等看文末即可啦!

    ?

    (更多內容+源碼都在文章匯總哦??!歡迎閱讀~)

    【Python小程序】紅紅火火過大年,(代碼)巧手編織中國結,分分鐘那驚艷你哦~_新年_06


    本文摘自 :https://blog.51cto.com/u

    開通會員,享受整站包年服務
    国产呦精品一区二区三区网站|久久www免费人咸|精品无码人妻一区二区|久99久热只有精品国产15|中文字幕亚洲无线码