<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 教你繪制冬奧吉祥物“冰墩墩”

          共 1430字,需瀏覽 3分鐘

           ·

          2022-02-12 03:21

          大家好,我是杰哥。

          這段時(shí)間,隨著北京冬奧會的開幕,吉祥物“冰墩墩”可是火出了圈,多少人排長隊(duì)都買不到。據(jù)說甚至有人把價(jià)格炒到了幾千元。

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

          Python版冰墩墩


          話不多說,直接上效果圖:


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

          用的是 Python 自帶的 turtle 庫,說個(gè)用 turtle 畫圖的小技巧:你可以通過

          turtle.bgpic(r'bg.png')

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

          由于代碼比較長,這里貼一小段供參考:

          #?愛心
          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()

          完整代碼可掃描下方二維碼,添加杰哥私人微信,備注:冰墩墩進(jìn)行獲取。

          推薦閱讀

          Python爬蟲實(shí)戰(zhàn) | 利用多線程爬取 LOL 高清壁紙

          利用 Python 實(shí)現(xiàn)多任務(wù)進(jìn)程

          手寫了個(gè) BOSS 來了的摸魚神器!

          我用 Python 自制成語接龍小游戲,刺激!

          瀏覽 49
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

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

          手機(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>
                  高清无码爱爱 | 伊人网影院| 日日夜夜大香蕉 | 午夜美女福利视频 | 欧美高潮AAAAAA片 |