赞
踩
输入代码:
import turtle
t = turtle.Pen()
for x in range(100):
t.circle(x)
t.left(30)
画出来是这样的:
把circle改成forward:
import turtle
t = turtle.Pen()
for x in range(100):
t.forward(x)
t.left(30)
就变成这样了:
换成红的:
import turtle
t = turtle.Pen()
t.pencolor("red")
for x in range(100):
t.forward(x)
t.left(30)
颜色太单调了,加几个颜色:
import turtle
t = turtle.Pen()
colors = ["red","blue","green","purple"]
for x in range(100):
t.pencolor(colors[x%4])
t.forward(x)
t.left(30)
背景不能老是白的:
import turtle
turtle.bgcolor("black")
t = turtle.Pen()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。