用python画明星_用python画一只可爱的皮卡丘实例
效果圖片# !\/usr\/bin\/env python # - * -編碼:utf - 8 - *\u2014\u2014從龜進口*\u201C畫皮卡丘的頭\u201Cdef的臉(x, y):\u201D\u201C畫臉\u201D\u201Cbegin_fill () penup () # goto烏龜移動到指定的坐標(x, y) pendown() #設置的方向龜setheading(40)圓(-150、69)fillcolor (\u201C# FBD624\u201D) #烏龜移動到指定的坐標penup()轉到(,)pendown () setheading圓(300)(-150年,30)setheading圓(295)(-140年,20)打印(位置())轉發(5)setheading圓(260)(-80、70)打印(位置())penup()轉到()pendown () penup() #烏龜移動到指定的坐標轉到(-144103)pendown () setheading圓(242)(110年,35)右(10)轉發(10)setheading圓(250)(80、115)打印(位置())penup()轉到()pendown () setheading (10) penup()轉到(-144、103)pendown () penup()轉到(x, y) pendown () end_fill() #下巴penup()轉到(-50)pendown () pencolor fillcolor (\u201C# DDA120\u201D) (\u201C# DDA120\u201D) begin_fill () setheading圓(-12)(120年25)setheading(-145)轉發(30)setheading圓(180)(-20年,20)setheading(143)轉發(30)end_fill () # penup () # # # goto烏龜移動到指定的坐標(0,0)# pendown () def眼睛():\u201D\u201C畫眼\u201D\u201C#左眼睛的顏色(\u201C黑色\u201D,\u201C黑色\u201D)penup()轉到(-110年,27)pendown () begin_fill () setheading (0)圓(24)end_fill() #左眼的野豬顏色(\u201C白\u201D,\u201C白色\u201D)penup()轉到(-105年,51)pendown () begin_fill () setheading(0)圈(10)end_fill() #右眼顏色(\u201C黑色\u201D,\u201C黑色\u201D)penup()轉到(25歲,40)pendown () begin_fill () setheading(0)圓(24)end_fill() #右眼的野豬顏色(\u201C白\u201D,\u201C白色\u201D)penup()轉到(62)pendown () begin_fill () setheading(0)圈(10)end_fill () def臉頰():\u201C漆臉頰\u201D\u201C#正確顏色(\u201C# 9 e4406\u201D、\u201C# FE2C21\u201D) penup()轉到(-130、-50)pendown () begin_fill () setheading(0)圓(27)end_fill() #左顏色(\u201C# 9 e4406\u201D、\u201C# FE2C21\u201D) penup()轉到(-20)pendown () begin_fill () setheading(0)圓(27)end_fill () (): def鼻子\u201D\u201C畫鼻子\u201D\u201C顏色(\u201C黑色\u201D,\u201C黑色\u201D)penup()轉到(-40年38)pendown () begin_fill()循環(7步驟= 3)end_fill () def口():\u201D\u201C畫嘴\u201D\u201C顏色(\u201C黑色\u201D,\u201C# F35590\u201D) #唇penup()轉到(-10年22)pendown () begin_fill () setheading(260)轉發(60)圓(-11、150)轉發(55)打印(位置())penup()轉到(,)pendown () end_fill() #舌頭顏色(\u201C# 6 a070d\u201D、\u201C# 6 a070d\u201D) begin_fill () penup()轉到(,)pendown () penup()轉到(,)pendown () penup()轉到(-52 5)pendown () penup()轉到(),p endown ()penup()轉到(,)pendown () penup()轉到(,)pendown () end_fill()顏色(\u201C黑色\u201D,\u201C# FFD624\u201D) penup()轉到(-78年,15)pendown () begin_fill () setheading(-25)我的范圍(2):setheading圓(-25)(70)end_fill()顏色(\u201C# AB1945\u201D、\u201C# AB1945\u201D) penup()轉到(-52 5)pendown () begin_fill () setheading(40)圓(-33、70)轉到()penup()轉到(-18、-17)pendown () setheading圓(155)(70)end_fill () def耳朵():\u201D\u201C畫耳朵\u201D\u201C#左耳顏色(\u201C黑色\u201D,\u201C# FFD624\u201D) penup()轉到(-145、93)pendown () begin_fill () setheading圓(165)(-248年,50)右(120)圓(-248年,50)end_fill()顏色(\u201C黑色\u201D,\u201C黑色\u201D)penup()轉到(-240、143)pendown () begin_fill () setheading圓(107)(-170年25)左圓(80)(229年,15)左圓(120)(300年,15)end_fill() #右耳顏色(\u201C黑色\u201D,\u201C# FFD624\u201D) penup()轉到(136)pendown () begin_fill () setheading圓(64)(-248年,50)右(120)圓(-248年,50)end_fill()顏色(\u201C黑色\u201D,\u201C黑色\u201D)penup()轉到(160、200)pendown () begin_fill () setheading(52)圓(170年25)左圓(116)(229年,15)左圓(71)(-300年,15)end_fill () (): def設置\u201D\u201C設置參數\u201D\u201Cpensize(2) #隱藏海龜hideturtle()速度(10)def主要():\u201D\u201C主函數\u201D\u201C設置()面對(-132115)眼睛()臉頰耳朵鼻子嘴巴()()()()()完成if __name__ = =\u201C__main__\u201D:主要()
總結
以上是生活随笔為你收集整理的用python画明星_用python画一只可爱的皮卡丘实例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 消息称第二代骁龙8继续台积电4nm:诡异
- 下一篇: 最畅销的日系轿车之一 新款日产天籁申报: