利用turtle库绘制四个圆环(大小、颜色、位置等自己设定)。
时间: 2023-04-02 07:00:33 浏览: 197
Python的turtle库绘制
5星 · 资源好评率100%
好的,我可以回答这个问题。以下是利用turtle库绘制四个圆环的代码:
import turtle
# 设置画布大小
turtle.setup(800, 600)
# 绘制第一个圆环
turtle.penup()
turtle.goto(-100, )
turtle.pendown()
turtle.pensize(5)
turtle.color("red")
turtle.circle(50)
# 绘制第二个圆环
turtle.penup()
turtle.goto(100, )
turtle.pendown()
turtle.pensize(5)
turtle.color("blue")
turtle.circle(50)
# 绘制第三个圆环
turtle.penup()
turtle.goto(, -100)
turtle.pendown()
turtle.pensize(5)
turtle.color("green")
turtle.circle(50)
# 绘制第四个圆环
turtle.penup()
turtle.goto(, 100)
turtle.pendown()
turtle.pensize(5)
turtle.color("purple")
turtle.circle(50)
# 隐藏画笔
turtle.hideturtle()
# 等待用户关闭窗口
turtle.done()
阅读全文