记录学习python
turtle.
hideturtle
()ide
turtle.
ht
(),隐藏龟图标。学习
turtle.
showturtle
()code
turtle.
st
(),显示龟图标。orm
turtle.
isvisible
(),龟是否显示。显示返回true,不然返回false。blog
turtle.
shape
(name=None),返回或设置形状,最初有如下形状:“arrow”, “turtle”, “circle”, “square”, “triangle”, “classic”。ci
turtle.
resizemode
(rmode=None),返回或设置龟形状状态。get
“auto”:调整对应于pensize值的乌龟的外观。跟随pensize变化大小。form
“user”:根据stretchfactor和outlinewidth(outline)的值来调整乌龟的外观。shapesize()与参数一块儿使用时调用resizemode(“user”)class
“noresize”:没有改变乌龟的外观。
turtle.
shapesize
(stretch_wid=None, stretch_len=None, outline=None)
turtle.
turtlesize
(stretch_wid=None, stretch_len=None, outline=None),返回或者设置形状拉伸大小和轮廓线。
stretch_wid是垂直方向拉伸,stretch_len水平方向拉伸,outline轮廓的宽度。
初始形状
运行,turtle.shapesize(5, 1, 1)
再运行turtle.shapesize(5, 1, 5)
turtle.
shearfactor
(shear=None),设置或者返回剪力。
turtle.
tilt
(angle),改变龟角度(按当前角度改变),但不改变移动方向。
turtle.
settiltangle
(angle),不管当前是什么角度,从新设置一个指向角度。不改变移动方向。自3.1版开始不推荐使用。
turtle.
tiltangle
(angle=None),返回当前倾斜角度,或从新设置一个指向角度。不改变移动方向。
turtle.
shapetransform
(t11=None, t12=None, t21=None, t22=None),设置或者返回龟形状矩阵数据。
turtle.
get_shapepoly
(),返回当前形状多边形做为坐标对的元组。可用于定义复合形状的新形状。
画个太极图;
import turtle as t t.home() t.bgcolor('#ccc') ##大半圆黑色 t.color('#000') t.fillcolor('#000') t.begin_fill() t.circle(100,180) t.end_fill() ##大半圆白色 t.color('#fff') t.fillcolor('#fff') t.begin_fill() t.circle(100,180) t.end_fill() t.up() t.sety(100) ##中半圆白色 t.color('#fff') t.fillcolor('#fff') t.begin_fill() t.circle(50,180) t.end_fill() t.up() t.goto(0,0) ##中半圆黑色 t.color('#000') t.fillcolor('#000') t.begin_fill() t.circle(-50,180) t.end_fill() ##两个小圆 t.up() t.sety(34) t.color('#fff') t.fillcolor('#fff') t.begin_fill() t.circle(16,360) t.end_fill() t.up() t.sety(134) t.color('#000') t.fillcolor('#000') t.begin_fill() t.circle(16,360) t.end_fill() t.ht()
如图: