Python海龜畫圖工具繪制叮當貓程序

使用海龜畫圖工具,畫一個叮當貓。
先學習幾個基本函數(shù):
import turtle;#引入海龜工具模塊
t=turtle.Pen()#創(chuàng)建海龜畫筆

創(chuàng)新互聯(lián)建站主打移動網站、成都網站設計、成都網站制作、網站改版、網絡推廣、網站維護、域名注冊、等互聯(lián)網信息服務,為各行業(yè)提供服務。在技術實力的保障下,我們?yōu)榭蛻舫兄Z穩(wěn)定,放心的服務,根據(jù)網站的內容與功能再決定采用什么樣的設計。最后,要實現(xiàn)符合網站需求的內容、功能與設計,我們還會規(guī)劃穩(wěn)定安全的技術方案做保障。

t.fillcolor("blue")#填充顏色
t.begin_fill()#開始填充
t.circle(160)#畫圓
t.end_fill()#結束填充

t.up() #鼠標抬起
t.goto(-20,240)#重新調整畫筆的位置
t.down()#鼠標落下

Python海龜畫圖工具繪制叮當貓程序

#畫叮當貓。
import turtle;
t=turtle.Pen()
#畫頭
t.fillcolor("blue")
t.begin_fill()
t.circle(160)
t.end_fill()
#畫臉
t.fillcolor("white")
t.begin_fill()
t.circle(130)
t.end_fill()
#畫眼睛
t.up()
t.goto(-20,240)#第一只眼睛(左)
t.down()
t.fillcolor("#fff")
t.begin_fill()
t.circle(20)
t.up()
t.goto(20,240)#第二只眼睛
t.down()
t.circle(20)
t.end_fill()

#畫里面的眼珠黑色部分
t.fillcolor("black")
t.begin_fill()
t.circle(10)
t.up()
t.goto(-20,240)
t.down()
t.circle(10)
t.end_fill()

#畫鼻子
t.up()
t.goto(0,200)
t.down()
t.fillcolor("red")
t.begin_fill()
t.circle(20)
t.end_fill()
t.right(90)
t.forward(70)
#畫嘴巴
t.up()
t.goto(-50,100)
t.down()
t.circle(50,180)

#畫胡子
t.up()
t.goto(20,150)
t.down()
t.right(100)
t.forward(80)
t.up()
t.goto(20,180)
t.down()
t.left(30)
t.forward(80)

t.up()
t.goto(20,160)
t.down()
t.left(-10)
t.forward(80)

#畫左邊胡子
t.up()
t.goto(-20,160)
t.down()
t.right(180)
t.forward(80)

t.up()
t.goto(-20,180)
t.down()
t.right(20)
t.forward(80)

t.up()
t.goto(-20,150)
t.down()
t.right(-40)
t.forward(80)

t.up()
t.goto(0,-50)
t.write("Python青少年編程 .13684090437何老師 ", align="center",font=("微軟雅黑", 16, "bold"))
t.write("https://edu.51cto.com/course/17675.html ", align="center",font=("微軟雅黑", 16, "bold"))

turtle.done()

分享名稱:Python海龜畫圖工具繪制叮當貓程序
文章URL:http://bm7419.com/article28/jdgpjp.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供響應式網站、品牌網站設計、網站建設、面包屑導航、云服務器、軟件開發(fā)

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都網站建設