亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

詳解Python如何利用turtle繪制中國結

 更新時間:2022年02月11日 10:40:16   作者:顧木子吖  
春節(jié)是中國特有的傳統(tǒng)節(jié)日,中國結是中華民族特有的純粹的文化精髓,富含豐富的文化底蘊。本文將利用turtle繪制一個中國結,需要的可以參考一下

導語

春節(jié)是中國特有的傳統(tǒng)節(jié)日,中國結是中華民族特有的純粹的文化精髓,富含豐富的文化底蘊,代表著我們對未來,對美好生活的向往和憧憬。新春佳節(jié),小編祝福大家虎年吉祥!萬事如意!祝我們的祖國引領世界,勇立潮頭!國富民強!

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

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

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

一、中國結 01  平安喜樂

1)效果圖

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)效果圖

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 煙火年年

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

總結

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

到此這篇關于詳解Python如何利用turtle繪制中國結的文章就介紹到這了,更多相關Python turtle繪制中國結內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • 如何利用Python實現(xiàn)n*n螺旋矩陣

    如何利用Python實現(xiàn)n*n螺旋矩陣

    這篇文章主要給大家介紹了關于如何利用Python實現(xiàn)n*n螺旋矩陣的相關資料,文中通過實例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2022-01-01
  • django遷移數(shù)據(jù)庫錯誤問題解決

    django遷移數(shù)據(jù)庫錯誤問題解決

    這篇文章主要介紹了django遷移數(shù)據(jù)庫錯誤問題解決,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2019-07-07
  • Python實用庫 PrettyTable 學習筆記

    Python實用庫 PrettyTable 學習筆記

    這篇文章主要介紹了Python實用庫 PrettyTable 學習筆記,結合實例形式分析了Python表格操作庫PrettyTable的安裝、使用技巧與相關注意事項,需要的朋友可以參考下
    2019-08-08
  • pandas數(shù)值排序的實現(xiàn)實例

    pandas數(shù)值排序的實現(xiàn)實例

    篩選和排序是Excel中使用頻率最多的功能,本文主要介紹了pandas數(shù)值排序的實現(xiàn)實例,文中通過示例代碼介紹的非常詳細,,感興趣的可以了解一下
    2021-07-07
  • keras分類之二分類實例(Cat and dog)

    keras分類之二分類實例(Cat and dog)

    這篇文章主要介紹了keras分類之二分類實例(Cat and dog),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-07-07
  • Python中序列的修改、散列與切片詳解

    Python中序列的修改、散列與切片詳解

    在Python中,最基本的數(shù)據(jù)結構是序列(sequence)。下面這篇文章主要給大家介紹了關于Python中序列的修改、散列與切片的相關資料文中通過示例代碼介紹的非常詳細,需要的朋友可以參考,下面來一起看看吧。
    2017-08-08
  • 對python條件表達式的四種實現(xiàn)方法小結

    對python條件表達式的四種實現(xiàn)方法小結

    今天小編就為大家分享一篇對python條件表達式的四種實現(xiàn)方法小結,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-01-01
  • Python如何使用內(nèi)置庫matplotlib繪制折線圖

    Python如何使用內(nèi)置庫matplotlib繪制折線圖

    這篇文章主要介紹了Python如何使用內(nèi)置庫matplotlib繪制折線圖,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2020-02-02
  • python批量替換多文件字符串問題詳解

    python批量替換多文件字符串問題詳解

    批量替換是我們在日常工作中經(jīng)常會遇到的一個問題,下面這篇文章主要給大家介紹了關于python批量替換多文件字符串問題的相關資料,文中通過示例代碼介紹的非常詳細,需要的朋友們下面隨著小編來一起學習學習吧。
    2018-04-04
  • python調(diào)用opencv實現(xiàn)貓臉檢測功能

    python調(diào)用opencv實現(xiàn)貓臉檢測功能

    這篇文章主要介紹了python調(diào)用opencv實現(xiàn)貓臉檢測功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-01-01

最新評論