Turtle海龜畫圖

#顏色單詞:
#紅色: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()      #顯示畫筆




最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容