python使用turtle库绘制奥运五环

时间:2024-01-26 11:22:34
效果图:
#奥运五环
import turtle
turtle.setup(1.0,1.0)    #设置窗口大小
turtle.title("奥运五环")
#蓝圆
turtle.penup()
turtle.right(90)
turtle.forward(-50)
turtle.left(90)
turtle.forward(-200)
turtle.pendown()
turtle.pensize(10)
turtle.color("blue")
turtle.circle(100)
#黑圆
turtle.penup()
turtle.forward(250)
turtle.pendown()
turtle.pensize(10)
turtle.color("black")
turtle.circle(100)
#红圆
turtle.penup()
turtle.forward(250)
turtle.pendown()
turtle.pensize(10)
turtle.color("red")
turtle.circle(100)
#黄圆
turtle.penup()
turtle.forward(-275)
turtle.right(-90)
turtle.pendown()
turtle.pensize(10)
turtle.color("yellow")
turtle.circle(100)
#绿圆
turtle.penup()
turtle.left(-90)
turtle.forward(50)
turtle.right(90)
turtle.pendown()
turtle.pensize(10)
turtle.color("green")
turtle.circle(100)

 嗨,欢迎大家扫码关注本人公众号,会经常分享一些编程实例以及一些资源喔!