Python海龟画图之3D红框

"""
3D红框,本程序画一个具有3D效果的红色框架,coloradd模块由李兴球编写,安装方法为在命令提示符下输入:pip install coloradd
"""

import turtle
from coloradd import *

screen = turtle.getscreen()
screen.delay(0)
screen.bgcolor("black")
screen.setup(480,360)
screen.title("3D红框by李兴球www.lixingqiu.com")

turtle.setheading(180)
turtle.pensize(6)
turtle.speed(0)
 
for i in range(30):
    turtle.pencolor(setcolor(i*2)) # 设置画笔颜色
    turtle.pensize(30-i)           # 画笔笔迹大小
    for j in range(8):             # 迭代j变量8次
        for k in range(4):         # 迭代k变量4次
            turtle.fd(100)         # 海龟前进100
            turtle.rt(90)          # 海龟右转90度
        turtle.rt(45)              # 海龟右转45度

screen.exitonclick()               # 关击屏幕关闭窗口
    

Python海龟画图之3D红框by李兴球www.lixingqiu.com