1-turtle坐标
1-坐标
见如下:
2-获取坐标
import turtle
p=turtle.Pen() #画布中心,起始位置
print(p.position()) #(0.00,0.00)
2-设置(移动)坐标
import turtle
p=turtle.Pen() #画布中心,起始位置
startpos=p.position() #获取坐标
print(startpos) #(0.00,0.00)
p.goto(200,0) #设置坐标
endpos=p.position() #(200.00,0.00)
print(endpos)
p.setpos(x,y)与p.setposition(x,y)同样可设置坐标,
p.setx(x)设置横坐标
p.sety(y)设置纵坐标
p.xcor()获取横坐标
p.ycor()获取纵坐标