Turtle库(海龟)

turtle库(会图库)
标准库+第三方库=python计算生态库
 
图体布局
turtle.setup(width,height,startx,starty) 设置窗体大小及位置(右上角位置电脑屏幕位置)
turtle.screensize(widith,height,"颜色")
 
空间坐标体系
绝对坐标
turtle.goto(x,y)
海归坐标
turtle.fd
turtle.bk
turtle.circle(radius,extent,step)
  角度     阶数  3  三角形
角度坐标体系
绝对角度
seth()改变海归行进方向 只改变方向但不行进
angle  绝对角度
海归角度
turtle.left(angle)
turtle.right(angle)
 
RGB色彩体系(红绿蓝)
0~255
白  255 255 255 1 1 1
黄  255 255 0 1 1 0
洋红 255 0 255 1 0 1
彩色切换 turtle.colormode(mode) 1.0小数  255 整数   默认小数
 
画笔控制函数
penup()提起画笔
pendown() 落下画笔
pensize() 画笔宽度
pencolor() 画笔颜色
dot(r)绘制圆点
颜色字符串 turtle.pencolor("purple")
RGB小数值 turtle.pencolor(0.63,0.13,0.94)
RGB元组值 turtle.pencolor((0.63,0.13.0.94))
 
运动控制函数
fd()
circle()

猜你喜欢

转载自www.cnblogs.com/renxiaoyan/p/9848888.html