目录python
turtle(海龟)库是turtle绘图体系的Python实现shell
Python计算生态 = 标准库 + 第三方库函数
turtle(海龟)是一种真实的存在布局
turtle.setup(width, height, startx, starty)
操作系统
setup()
设置窗体大小及位置setup()
不是必须的import turtle turtle.goto( 100, 100) turtle.goto( 100,-100) turtle.goto(-100,-100) turtle.goto(-100, 100) turtle.goto(0,0)
turtle.seth(angle)
设计
seth()
改变海龟行进方向angle
为绝对度数seth()
只改变方向但不行进import turtle turtle.left(45) turtle.fd(150) turtle.right(135) turtle.fd(300) turtle.left(135) turtle.fd(150)
由三种颜色构成的万物色3d
英文名称 | RGB整数值 | RGB小数值 | 中文名称 |
---|---|---|---|
white | 255,255,255 | 1,1,1 | 白色 |
yellow | 255,255,0 | 1,1,0 | 黄色 |
magenta | 255,0,255 | 1,0,1 | 洋红 |
cyan | 0,255,255 | 0,1,1 | 青色 |
blue | 0,0,255 | 0,0,1 | 蓝色 |
black | 0,0,0 | 0,0,0 | 黑色 |
seashell | 255,245,238 | 1,0.96,0.93 | 海贝色 |
gold | 255,215,0 | 1,0.84,0 | 金色 |
pink | 255,192,203 | 1,0.75,0.80 | 粉红色 |
brown | 165,42,42 | 0.65,0.16,0.16 | 棕色 |
purple | 160,32,240 | 0.63,0.13,0.94 | 紫色 |
tomato | 255,99,71 | 1,0.39,0.28 | 番茄色 |
默认采用小数值 可切换为整数值code
turtle.colormode(mode)
orm
更换模式前:turtle.pencolor('red')
;更换模式后:turtle.pencolor(0,255,255)
orturtle.pencolor(0,1,1)
blog