#顏色單詞:
#紅色:red 白色:white 黃色:yellow 藍(lán)色:blue
#黑色:black 青色:cyan 洋紅:magenta 金色:gold
#粉色:pink 紫色:purple 番茄色:tomato 棕色:brown
#橙色:orange 綠色:green 海貝色:seashell
import turtle as t
t.setup(500,600)#設(shè)置畫布大小
#畫筆形狀有:turtle,arrow,circle,triangle,classic
t.shape("turtle") #設(shè)置畫筆形狀
t.begin_fill()
t.color("red","black")#畫筆顏色/填充顏色
t.speed(0)#1-10變快,0最快
t.fd(100)
t.circle(100,360,100) #半徑,角度,邊數(shù)
t.end_fill()
t.up()
t.goto(100,-200)
t.seth(120)
t.dot(100,"red") #畫點(diǎn)(大小,顏色)
t.dot(80,"white")
t.dot(60,"red")
t.dot(40,"blue")
t.pos()#獲取畫筆x,y坐標(biāo)
print("x=",t.pos()[0])
print("y=",t.pos()[1])
t.reset()#重置畫布畫筆
t.done()#完成繪制
t.hideturtle() #隱藏畫筆
t.showturtle() #顯示畫筆
Turtle海龜畫圖
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
推薦閱讀更多精彩內(nèi)容
- 格式 功能:在海龜當(dāng)前位置印制一個(gè)海龜形狀。返回該印章的 stamp_id,印章可以通過調(diào)用 clearstamp...
- 設(shè)置畫筆形狀 turtle 自帶形狀 列出所有形狀 自定義 turtle 形狀 說明: t.register_sh...
- 格式 第一個(gè)參數(shù) radius 是半徑圓心坐標(biāo)是(0,radius)半徑是 radiusradius 可以是負(fù)數(shù)r...
- 格式1:turtle.color(color)格式2:turtle.color(color_1,color_2) ...