学习记录,
 笔控制
 turtle.pendown()
 turtle.pd()
 turtle.down(),下笔,移动时绘画。
turtle.penup()
 turtle.pu()
 turtle.up(),拿起笔,移动时不绘画。
turtle.pensize(width=None)
 turtle.width(width=None),返回或者设置笔画宽度。
turtle.pen(pen=None, **pendict),设置笔的属性。
 “shown”: True/False
 “pendown”: True/False
 “pencolor”: color-string or color-tuple
 “fillcolor”: color-string or color-tuple
 “pensize”: positive number
 “speed”: number in range 0…10
 “resizemode”: “auto” or “user” or “noresize”
 “stretchfactor”: (positive number, positive number)
 “outline”: positive number
 “tilt”: number
turtle.isdown(),是否下笔,下笔返回True,提起笔False。
turtle.fillcolor(*args),返回或设置填充颜色。
 可以是,fillcolor(colorstring)像"violet","#33cc8c";fillcolor((r, g, b));fillcolor(r, g, b)。
 配合begin_fill()和end_fill()使用。
运行到turtle.end_fill()填充。
turtle.color(*args),返回或设置笔的颜色和填充的颜色。
 color(colorstring1, colorstring2), color((r1,g1,b1), (r2,g2,b2)),等效于pencolor(colorstring1) 和 fillcolor(colorstring2)
turtle.filling(),返回填充状态,有设置开始填充返回True,否则返回False。
turtle.begin_fill(),开始填充位置。
 turtle.end_fill(),结束填充位置。
turtle.reset(),重置,龟返回原点并清除已绘屏,
turtle.clear(),清除已绘屏,龟当前状态和位置不变。
turtle.write(arg, move=False, align=“left”, font=(“Arial”, 8, “normal”)),写入文本。
 arg要写入的文本,move是否向右移动,align文本对齐,font字体大小,格式…元组。
试画下简单的图;
 import turtle as t
t.home() #开始原点
 t.fillcolor(‘violet’) #填充颜色
 t.penup() #拿起笔
 t.begin_fill() #开始填充violet色
 t.stamp() #当前位置复制龟图形
 t.fd(100) #向前移100
 t.setheading(90) #设置指向角度90
 t.stamp()
 t.fd(100)
 t.lt(90) #向左转90度
 t.end_fill() #结束填充
 t.fillcolor(‘cyan’)
 t.stamp()
 t.begin_fill()
 t.fd(100)
 t.lt(90)
 t.stamp()
 t.fd(100)
 t.end_fill()
 t.home()
##画另一个图
 t.setpos(0,-150) #移到坐标0,-150
 t.pendown() #放下笔开始绘
 t.pencolor(‘violet’) #设笔颜色
 for i in range(0,24):
 t.forward(100)
 t.left(105)
 t.stamp()