不说废话,直接搞
- 函数库导入 import turtle
- 设置窗口的位置和大小 turtle.setup(width,height,startx,starty)
相对于桌面的起始点的坐标以及窗口的宽度高度,若不写窗口的起始点,则默认在桌面的正中心。 - 移动画笔 turtle.goto(100,100),绝对坐标
- 沿前方向运行 turtle.fd(d) forward d可以为负数
- 沿反方向运行 turtle.bk(d) backward d可以为负数
- 沿海龟左侧的某一点做圆运动 turtle.circle(r,angle)
- 只改变海龟的行进方向,绝对角度。 turtle.setheading(angle)或者turtle.seth()
- 相对角度 turtle.left(angle) turtle.right(angle)
- 调节颜色模式 turtle.colormode(mode) 1.0:RGB小数模式 255:RGB整数模式
- 画笔抬起 turtle.penup() 别名turtle.pu()
- 画笔落下 turtle.pendown() 别名turtle.pd()
- 画笔宽度 turtle.pensize(width) 别名turtle.width(width)
- turtle.pencolor(color) color为颜色字符串或者rgb值
eg:turtle.pencolor(“purple”)颜色字符串
turtle.pencolor(0.63,0.13,0.94)RGB的小数值
turtle.pencolor((0.63,0.13,0.94))RGB的元组值