<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Python繪制冬奧吉祥物“冰墩墩”

          共 1597字,需瀏覽 4分鐘

           ·

          2022-02-13 06:49

          大家好?!


          這兩天,隨著北京冬奧會(huì)的開(kāi)幕,吉祥物“冰墩墩”可是火出了圈,多少人排長(zhǎng)隊(duì)都買(mǎi)不到。據(jù)說(shuō)甚至有人把價(jià)格炒到了幾千元。


          就連昨天的“虎虎生威”文章下面,都有同學(xué)求冰墩墩

          為了幫助大家早日實(shí)現(xiàn)“一戶一墩”,Crossin連夜加班,肝出了這個(gè):


          Python版冰墩墩


          話不多說(shuō),直接上效果。


          繪制過(guò)程:


          最終成圖:


          說(shuō)實(shí)話,這個(gè)沒(méi)什么技術(shù)含量,就是硬“肝”,不斷調(diào)整曲線細(xì)節(jié)。


          用的是 Python 自帶的 turtle 庫(kù)。這個(gè)庫(kù)之前介紹過(guò)很多次,就不再啰嗦了,需要的同學(xué)看文末推薦閱讀,或者在公眾號(hào)歷史文章里搜索“turtle”或“海龜作圖”就能看到。


          說(shuō)個(gè)用 turtle 畫(huà)圖的小技巧:你可以通過(guò)

          turtle.bgpic(r'bg.png')

          這個(gè)語(yǔ)句把你要參考的圖先繪制在窗口中,然后再對(duì)照著進(jìn)行繪制調(diào)整,就方便許多了。




          由于代碼比較長(zhǎng),這里貼一小段供參考:

          # 愛(ài)心turtle.penup()turtle.goto(220, 115)turtle.pencolor("brown")turtle.pensize(1)turtle.fillcolor("brown")turtle.begin_fill()turtle.pendown()turtle.setheading(36)turtle.circle(-8, 180)turtle.circle(-60, 24)turtle.setheading(110)turtle.circle(-60, 24)turtle.circle(-8, 180)turtle.end_fill()
          # 五環(huán)turtle.penup()turtle.goto(-5, -170)turtle.pendown()turtle.pencolor("blue")turtle.circle(6)turtle.penup()turtle.goto(10, -170)turtle.pendown()turtle.pencolor("black")turtle.circle(6)turtle.penup()turtle.goto(25, -170)turtle.pendown()turtle.pencolor("brown")turtle.circle(6)turtle.penup()turtle.goto(2, -175)turtle.pendown()turtle.pencolor("lightgoldenrod")turtle.circle(6)turtle.penup()turtle.goto(16, -175)turtle.pendown()turtle.pencolor("green")turtle.circle(6)turtle.penup()
          turtle.pencolor("black")turtle.goto(-16, -160)turtle.write("BEIJING 2022", font=('Arial', 10, 'bold italic'))turtle.hideturtle()
          turtle.done()


          完整代碼已上傳,需要的同學(xué)請(qǐng)?jiān)诠娞?hào)“Crossin的編程教室”里回復(fù)關(guān)鍵字:?冰墩墩

          如果文章對(duì)你有幫助,歡迎轉(zhuǎn)發(fā)/點(diǎn)贊/收藏~



          相關(guān)閱讀:


          瀏覽 73
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  欧美AAAAAAAAAA特级 | 黄色小视频在线免费观看 | 美国黑人一级大黄 | 九九九久久久 | 干骚逼视频 |