日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

用Python画一只蝙蝠

發(fā)布時(shí)間:2025/3/15 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 用Python画一只蝙蝠 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

畫圖的部分函數(shù)及應(yīng)該怎么做見如何用Python畫畫
不bb,直接上代碼

import turtle as t import math ''' 部分函數(shù)及參數(shù)說明: pen_move():畫每個(gè)部位時(shí),都必須先抬起畫筆,移動(dòng)到指定位置后落下 pen_set():用來設(shè)置畫筆的顏色尺寸等 t.setup(width,height):入寬和高為整數(shù)時(shí),表示像素;為小數(shù)時(shí),表示占據(jù)電腦屏幕的比例 t.speed():設(shè)置畫筆速度 t.goto():以左下角為坐標(biāo)原點(diǎn),進(jìn)行畫筆的移動(dòng) t.circle(radius,extent):設(shè)置指定半徑radius的圓,參數(shù)為半徑,半徑為正(負(fù)),表示圓心在畫筆的左邊(右邊)畫圓,extent為角度,若畫圓則無須添加。如:t.circle(-20,90),順時(shí)針,半徑20畫弧,弧度90 t.seth(degree)絕對角度,將畫筆的方向設(shè)置為一定的度數(shù)方向,0-東;90-北;180-西;270-'''wight=800 height=600 #t.hideturtle() t.setup(wight,height) t.speed(10)def pen_move(x,y):t.penup()t.goto(x-wight/2+50,y-height/2+50)t.pendown()def pen_set(size,r1,g1,b1):t.pensize(size)t.color(r1,g1,b1)def draw_face():#第一個(gè)眼睛pen_move(300,350)pen_set(2,0,0,0)t.begin_fill()t.circle(15)t.end_fill()#第二個(gè)眼睛pen_move(400,350)t.begin_fill()t.circle(15)t.end_fill()#第一個(gè)眼眶pen_move(300,350)t.circle(25)#第二個(gè)眼眶pen_move(400,350)t.circle(25)#右邊臉框pen_move(370,280)t.circle(60,120)#左邊臉框t.seth(180)pen_move(330,280)t.circle(-60,120)#頭上一撮t.seth(0)pen_move(300,400)t.forward(100)#左鼻孔pen_move(335,330)t.begin_fill()t.circle(3)t.end_fill()#右鼻孔pen_move(375, 330)t.begin_fill()t.circle(5)t.end_fill()#嘴巴pen_move(310,315)t.left(300)t.circle(50,140)#舌頭t.seth(270)pen_move(350,290)t.forward(30)pen_move(328,280)t.circle(53,60)t.left(300)pen_move(372,280)t.circle(-53,60)# 左耳朵pen_move(273,345)t.left(300)t.circle(-80,50)pen_move(271,330)t.left(40)t.circle(-125,50)pen_move(277,360)t.left(30)t.circle(115,30)pen_move(280,385)t.left(325)t.circle(70,60)#右耳朵pen_move(427,345)t.right(140)t.circle(80,50)pen_move(429,330)t.right(40)t.circle(120,48)pen_move(422,360)t.right(30)t.circle(-115,30)pen_move(420,385)t.right(325)t.circle(-60,60)#頭畫完了,但看著像青蛙,湊活著用吧def draw_body():#畫身子pen_move(290,298)t.left(250)t.circle(250,55)pen_move(410, 298)t.left(330)t.circle(-250, 55)#肚臍pen_move(340,150)t.seth(0)t.left(45)t.forward(30)pen_move(360, 150)t.seth(180)t.left(45+270)t.forward(30)def draw_feet():#畫左腳pen_move(325,110)t.left(80)t.circle(50,90)pen_move(335,98)t.left(270)t.circle(20,90)pen_move(330,72)t.circle(-20,135)pen_move(315,40)t.right(60)t.circle(-25,60)#畫右腳pen_move(377,110)t.right(76)t.circle(-50,90)pen_move(370, 98)t.left(85)t.circle(-20, 90)pen_move(380, 75)t.circle(20, 135)pen_move(400, 48)t.right(270)t.circle(25, 60)def draw_wings():#左翅pen_move(288,280)t.circle(-230,35)pen_move(175,355)t.circle(58,110)pen_move(81,350)t.circle(280,30)pen_move(43,212)t.left(140)t.circle(-80,80)pen_move(145,230)t.left(75)t.circle(-75,75)pen_move(232,240)t.left(60)t.circle(-40,90)#右翅pen_move(350-288+350,280)t.left(78)t.circle(230,35)pen_move(700-175, 355)t.circle(-58, 110)pen_move(700-81, 350)t.circle(-280, 30)pen_move(700-43+2, 212)t.left(218)t.circle(80, 80)pen_move(700-145+2, 230)t.left(290)t.circle(75, 75)pen_move(700-232, 240-4)t.left(270)t.circle(40, 90)draw_face() draw_body() draw_feet() draw_wings()

總結(jié)

以上是生活随笔為你收集整理的用Python画一只蝙蝠的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。