<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片在线观看不卡| 九九九精品视频免费| 久久免费观看国产精品88av| 国产亚洲A∨片在线观看| 国产久爱免费精品视频 | 亚洲av鲁丝一区二区三区| 国产线视频精品免费观看视频| 久久精品国产亚洲Aⅴ香蕉 | 亚洲精品在线观看视频| 97公开免费视频| 亚洲国产精品yw在线观看| 国产卡二卡三卡四卡免费网址| 亚洲性色精品一区二区在线| 免费视频中文字幕| 美女羞羞免费视频网站| 亚洲综合亚洲综合网成人| 久久国产精品国产自线拍免费| 亚洲VA中文字幕无码一二三区 | 中文字幕人成人乱码亚洲电影| 99久久免费国产精精品| 久久精品国产亚洲AV果冻传媒 | 久久国产精品成人片免费| 亚洲av片不卡无码久久| 欧洲美熟女乱又伦免费视频| 成年网在线观看免费观看网址| 亚洲av永久无码精品表情包| 国产精品怡红院永久免费| 国产亚洲一卡2卡3卡4卡新区| 亚洲一区二区三区免费| 亚洲一区二区三区免费观看 | 亚洲人成网站看在线播放| 国产大片51精品免费观看| 天黑黑影院在线观看视频高清免费 | 久久青草免费91线频观看不卡| 亚洲另类春色国产精品| 亚洲国产精品狼友中文久久久| 一级毛片成人免费看免费不卡| 亚洲欧洲日产国码久在线| 亚洲熟女少妇一区二区| 日韩精品成人无码专区免费| 中文字幕a∨在线乱码免费看|