通过改变颜色,圆的半径,及旋转角度来形成圆图形
import turtle
import colorsys as cs # 导入颜色转换模块
# 设置显示屏幕
screen = turtle.Screen()
screen.title("渐变色的圆")
screen.bgcolor('#AFEEEE')
# 设置画笔
p = turtle.Turtle()
p.pensize(1)
p.speed(0)
# 设置初始位置
p.penup()
p.goto(0,0)
p.pendown()
# 循环画圆,并设置渐变色
for i in range(4):
for j in range(100):
p.color(cs.hls_to_rgb(j/100,0.5,0.5))
p.circle(10+j*2)
p.right(90)
p.penup()
p.goto(0,420) # 更改位置
p.pendown()
p.pensize(3) # 设置画笔粗细
p.right(180) # 旋转
p.circle(420) # 画一个大圆
p.penup()
p.hideturtle()
turtle.done()
标签:turtle,right,penup,Python,渐变色,渐变,设置,绘制,screen
From: https://blog.csdn.net/2202_75561400/article/details/143702293