<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        如何用python畫豬頭

        來源:懂視網 責編:小采 時間:2020-11-02 18:25:38
        文檔

        如何用python畫豬頭

        如何用python畫豬頭:用python畫豬頭的方法:首先設置畫布和畫筆,代碼為【a.screensize(400,300)a.setup(width=400,height=300)】;然后畫臉型,代碼為【.goto(-100,100)】;最后留存圖像在畫布上即可?!鞠嚓P學習推薦:python視頻】用python畫豬頭的方法:畫布和畫
        推薦度:
        導讀如何用python畫豬頭:用python畫豬頭的方法:首先設置畫布和畫筆,代碼為【a.screensize(400,300)a.setup(width=400,height=300)】;然后畫臉型,代碼為【.goto(-100,100)】;最后留存圖像在畫布上即可。【相關學習推薦:python視頻】用python畫豬頭的方法:畫布和畫

        用python畫豬頭的方法:首先設置畫布和畫筆,代碼為【a.screensize(400,300)a.setup(width=400,height=300)】;然后畫臉型,代碼為【.goto(-100,100)】;最后留存圖像在畫布上即可。

        【相關學習推薦:python視頻】

        用python畫豬頭的方法:

        畫布和畫筆設置

        import turtle as a
        a.screensize(400,300)//設置屏幕大小
        a.setup(width=400,height=300)//設置畫布大小
        a.pensize(15)//設置畫筆寬度
        a.speed(5)//設置畫筆速度
        a.hideturtle()//隱藏畫筆

        畫臉盤子

        a.penup()//提筆
        a.goto(-100,100)//移動畫筆位置
        a.setheading(180)//設置朝向正西
        a.pencolor("pink")
        a.pendown()//放筆
        a.circle(200)

        取名字

        a.penup()//取名
        a.goto(-150,10)
        yourname=a.textinput("請老實回答","你的名字是?")
        name=yourname+"崽崽"
        a.pendown()
        a.write(name,font=("elephant",25,"bold"))//打印文本

        畫眼睛

        a.penup()//畫左眼
        a.goto(-200,0)
        a.pendown()
        a.circle(25)
        a.penup()
        a.goto(-200,-14)
        a.pendown()
        a.circle(9)
        a.penup()//光暈
        a.goto(-190,-20)
        a.pencolor("white")
        a.pendown()
        a.dot(10)
        a.penup()//畫右眼
        a.pencolor("pink")
        a.goto(0,0)
        a.pendown()
        a.circle(25)
        a.penup()//光暈
        a.goto(0,-14)
        a.pendown()
        a.circle(9)
        a.penup()
        a.goto(-10,-20)
        a.pencolor("white")
        a.pendown()
        a.dot(10)

        畫鼻子

        a.penup()//畫鼻子
        a.speed(10)//設置畫筆速度
        a.pencolor("pink")
        a.goto(-150,-75)
        a.setheading(45)
        a.pendown()
        for i in range(90):
         a.forward(1.5)
         a.right(1)
        for i in range(3): //圓化棱角,每轉16度向前走3個像素
         a.right(16)
         a.forward(3)
        a.forward(15)
        for i in range(3): //圓化棱角
         a.right(16)
         a.forward(3)
        a.setheading(225)
        for i in range(90):
         a.forward(1.5)
         a.right(1)
        for i in range(3): //圓化棱角
         a.right(16)
         a.forward(3)
        a.forward(15)
        for i in range(3): //圓化棱角
         a.right(16)
         a.forward(3)
        a.penup()
        a.speed(5)//設置畫筆速度
        a.goto(-125,-70)//第一條杠
        a.setheading(270)
        a.pendown()
        a.forward(50)
        a.penup()
        a.goto(-70,-65)//第二條杠
        a.pendown()
        a.forward(55)

        畫嘴巴

        a.penup()//畫嘴巴
        a.speed(10)//設置畫筆速度
        a.goto(-135,-165)
        a.setheading(305)
        a.pendown()
        for i in range(120):
         a.forward(1)
         a.left(1)

        畫耳朵

        a.penup()//畫右耳朵
        a.speed(5)
        a.setheading(0)
        a.goto(-17,90)
        a.pendown()
        a.forward(60)
        a.penup()
        a.goto(28,75)//跳到下一筆起始位置
        a.setheading(45)
        a.pendown()
        a.forward(110)
        a.right(45)
        a.forward(40)
        a.setheading(225)
        a.forward(40)
        a.setheading(270)
        for i in range(7): //圓化棱角
         a.right(2.5)
         a.forward(10)
        a.forward(80)
        a.penup()//畫左耳朵
        a.goto(-183,90)
        a.setheading(180)
        a.pendown()
        a.forward(60)
        a.penup()
        a.goto(-230,75)//跳到下一筆起始位置
        a.setheading(135)
        a.pendown()
        a.forward(110)
        a.left(45)
        a.forward(40)
        a.setheading(-45)
        a.forward(40)
        a.setheading(270)
        for i in range(10): //圓化棱角
         a.left(2.5)
         a.forward(15)

        畫腮紅

        a.penup()//畫左腮紅
        a.pencolor("tomato")//設置成番茄色
        a.goto(-250,-100)
        a.setheading(270)
        a.pendown()
        a.forward(20)
        a.penup()
        a.goto(-210,-100)
        a.pendown()
        a.forward(20)
        a.penup()//畫右腮紅
        a.goto(10,-100)
        a.pendown()
        a.forward(20)
        a.penup()
        a.goto(50,-100)
        a.pendown()
        a.forward(20)
        a.done() //留存圖像在畫布上

        獻上完整源代碼

        #!/usr/bin/env python3.7 #指明用什么可執行程序運行這個文件代碼
        #-*- coding:UTF-8 -*- #保證能順利解析中文
        #author:Boosirit time:2020/4/5
        import turtle as a
        a.screensize(400,300)#設置屏幕大小
        a.setup(width=400,height=300)#設置畫布大小
        a.pensize(15)#設置畫筆寬度
        a.speed(5)#設置畫筆速度
        a.hideturtle()#隱藏畫筆
        a.penup()#畫臉
        a.goto(-100,100)
        a.setheading(180)#設置朝向正西
        a.pencolor("pink")
        a.pendown()
        a.circle(200)
        a.penup()#取名
        a.goto(-150,10)
        yourname=a.textinput("請老實回答","你的名字是?")
        name=yourname+"崽崽"
        a.pendown()
        a.write(name,font=("elephant",25,"bold"))#打印文本
        a.penup()#畫左眼
        a.goto(-200,0)
        a.pendown()
        a.circle(25)
        a.penup()
        a.goto(-200,-14)
        a.pendown()
        a.circle(9)
        a.penup()#光暈
        a.goto(-190,-20)
        a.pencolor("white")
        a.pendown()
        a.dot(10)
        a.penup()#畫右眼
        a.pencolor("pink")
        a.goto(0,0)
        a.pendown()
        a.circle(25)
        a.penup()#光暈
        a.goto(0,-14)
        a.pendown()
        a.circle(9)
        a.penup()
        a.goto(-10,-20)
        a.pencolor("white")
        a.pendown()
        a.dot(10)
        a.penup()#畫鼻子
        a.speed(10)#設置畫筆速度
        a.pencolor("pink")
        a.goto(-150,-75)
        a.setheading(45)
        a.pendown()
        for i in range(90):
         a.forward(1.5)
         a.right(1)
        for i in range(3):#圓化棱角,每轉16度向前走3個像素
         a.right(16)
         a.forward(3)
        a.forward(15)
        for i in range(3):#圓化棱角
         a.right(16)
         a.forward(3)
        a.setheading(225)
        for i in range(90):
         a.forward(1.5)
         a.right(1)
        for i in range(3):#圓化棱角
         a.right(16)
         a.forward(3)
        a.forward(15)
        for i in range(3):#圓化棱角
         a.right(16)
         a.forward(3)
        a.penup()
        a.speed(5)#設置畫筆速度
        a.goto(-125,-70)#第一條杠
        a.setheading(270)
        a.pendown()
        a.forward(50)
        a.penup()
        a.goto(-70,-65)#第二條杠
        a.pendown()
        a.forward(55)
        a.penup()#畫嘴巴
        a.speed(10)#設置畫筆速度
        a.goto(-135,-165)
        a.setheading(305)
        a.pendown()
        for i in range(120):
         a.forward(1)
         a.left(1)
         
        a.penup()#畫右耳朵
        a.speed(5)
        a.setheading(0)
        a.goto(-17,90)
        a.pendown()
        a.forward(60)
        a.penup()
        a.goto(28,75)#跳到下一筆起始位置
        a.setheading(45)
        a.pendown()
        a.forward(110)
        a.right(45)
        a.forward(40)
        a.setheading(225)
        a.forward(40)
        a.setheading(270)
        for i in range(7):#圓化棱角
         a.right(2.5)
         a.forward(10)
        a.forward(80)
        a.penup()#畫左耳朵
        a.goto(-183,90)
        a.setheading(180)
        a.pendown()
        a.forward(60)
        a.penup()
        a.goto(-230,75)#跳到下一筆起始位置
        a.setheading(135)
        a.pendown()
        a.forward(110)
        a.left(45)
        a.forward(40)
        a.setheading(-45)
        a.forward(40)
        a.setheading(270)
        for i in range(10):#圓化棱角
         a.left(2.5)
         a.forward(15)
         
        a.penup()#畫左腮紅
        a.pencolor("tomato")#設置成番茄色
        a.goto(-250,-100)
        a.setheading(270)
        a.pendown()
        a.forward(20)
        a.penup()
        a.goto(-210,-100)
        a.pendown()
        a.forward(20)
        a.penup()#畫右腮紅
        a.goto(10,-100)
        a.pendown()
        a.forward(20)
        a.penup()
        a.goto(50,-100)
        a.pendown()
        a.forward(20)
        a.done()#留存圖像在畫布上

        想了解更多編程學習,敬請關注php培訓欄目!

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        如何用python畫豬頭

        如何用python畫豬頭:用python畫豬頭的方法:首先設置畫布和畫筆,代碼為【a.screensize(400,300)a.setup(width=400,height=300)】;然后畫臉型,代碼為【.goto(-100,100)】;最后留存圖像在畫布上即可。【相關學習推薦:python視頻】用python畫豬頭的方法:畫布和畫
        推薦度:
        標簽: 豬頭 python 用python
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 最近中文字幕无免费| 国产午夜成人免费看片无遮挡 | 精品无码AV无码免费专区| 亚洲综合色在线观看亚洲| 国产精品玖玖美女张开腿让男人桶爽免费看| 国产色婷婷精品免费视频| 国产精品亚洲专区一区| 又粗又黄又猛又爽大片免费| 黄色一级毛片免费| 亚洲一区二区三区AV无码| 毛片在线全部免费观看| 亚洲精品电影天堂网| 丁香花在线观看免费观看| 欧美亚洲精品一区二区| 亚洲人成影院在线无码观看| 青青草原1769久久免费播放| 亚洲最大中文字幕| 精品免费国产一区二区三区| 大片免费观看92在线视频线视频| 亚洲AV午夜成人影院老师机影院| 国产曰批免费视频播放免费s| 亚洲成a人无码亚洲成av无码| 亚洲美女高清一区二区三区 | 亚洲人成网站999久久久综合| 国产精品色午夜视频免费看| 亚欧洲精品在线视频免费观看| 亚洲AV永久青草无码精品| 国产在线观看片a免费观看| 国产精品无码亚洲精品2021| 亚洲另类激情综合偷自拍图| jjizz全部免费看片| 国产成人精品亚洲| 亚洲一区二区三区高清| 国内精品免费视频自在线| 99精品免费视品| 亚洲国产精品一区二区三区在线观看| 亚洲国产精品一区二区九九| 在线看无码的免费网站| 免费看一级一级人妻片| 亚洲欧洲国产综合| 亚洲三区在线观看无套内射|