Commit 719078ac by BellCodeEditor

auto save

parent f64ca328
Showing with 5 additions and 0 deletions
import turtle # 导入turtle模块 import turtle # 导入turtle模块
pen = turtle.Pen() # 创建画笔 pen = turtle.Pen() # 创建画笔
screen=turtle.Screen() # 从turtle模块中取出画布
screen.bgcolor("black") # 用bgcolor()方法,将画布设为黑色
colors=["green","red","orange","yellow"] # 创建列表保存四种颜色
for i in range(1,300): for i in range(1,300):
# 变量i对4求余后作为列表索引号并设为pencolor()参数
pen.pencolor(colors[i%4])
pen.forward(i) # 变量1表示画笔移动的距离 pen.forward(i) # 变量1表示画笔移动的距离
pen.right(91) # 右转91 pen.right(91) # 右转91
pen.hideturtle() # 隐藏画笔 pen.hideturtle() # 隐藏画笔
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment