import turtle as t
t.setup(800,600,0,0,)
t.pensize(2)
t.speed(1)
t.color(“purple”)
t.shape(“turtle”)
a=input(“请输入任意1-10以内的数值:”)
a=eval(a) #红色部分可以改成a=5
for i in range(50):
a=a+10
t.left(90)
t.fd(a)
t.done()
以上就是小编为大家带来的使用Turtle画正螺旋线的
本文实例主要是对turtle的使用,实现Python+turtle动态绘制一棵树的实例,具体代码:
# drawtree.py
from turtle import Turtle, mainloop
def tree(plist, l, a, f):
plist is list of pens
l is length of branch
a is half of the angle between 2 branches
f is factor by which branch