下面的程序需要coloradd模块支持,安装方法:按Ctrl + R键打开运行对话框,输入cmd,按确定。在弹出的管理员窗口中输入pip install coloradd
以下是学生考试时候的代码:
import turtle from coloradd import * turtle.pensize(10) turtle.bgcolor('black') turtle.colormode(255) turtle.speed(0) turtle.delay(0) turtle.penup() turtle.sety(250) c = (0,0,255) for x in range(18): for s in range(45): c = coloradd(c,0.01) turtle.color(c) turtle.fd(12) turtle.rt(8) for w in range(45): turtle.pensize(3) c = coloradd(c,0.01) turtle.color(c) turtle.fd(10) turtle.rt(8) turtle.pensize(10) turtle.penup() turtle.fd(100) turtle.rt(20) turtle.pendown()
发表评论