import turtle as t # 导入海龟库
import random # 导入随机库
t.bgcolor("#C9DDF2")
t.speed(10)
colors = ["#FFB6C1", "#F08080", "#FFA07A", "#FFC0CB", "#FFDAB9", "#FFE4E1"]

def aixin():
    t.down()
    color = random.choice(colors)
    t.color(color)
    t.begin_fill()
    t.setheading(0)
    t.left(45)
    t.fd(40)
    t.circle(20,180)
    t.right(90)
    t.circle(20,180)
    t.fd(40)
    t.left(45)
    t.end_fill()

t.up()
t.goto(0,-350)
t.down()
for i in range(8):
    aixin()
    t.left(45);t.fd(60)
for i in range(12):
    a = t.heading()
    aixin()
    t.setheading(a)
    t.circle(240,15)
t.right(90)
for i in range(12):
    a = t.heading()
    aixin()
    t.setheading(a)
    t.circle(240,15)
for i in range(8):
    aixin()
    t.right(45);t.fd(60)

1 条评论

  • @ 2024-5-12 11:56:11
    import turtle as t # 导入海龟库
    import random # 导入随机库
    t.bgcolor("#C9DDF2")
    t.speed(0)
    colors = ["#FFB6C1", "#F08080", "#FFA07A", "#FFC0CB", "#FFDAB9", "#FFE4E1"]
    
    def aixin():
        t.down()
        color = random.choice(colors)
        t.color(color)
        t.begin_fill()
        t.setheading(0)
        t.left(45)
        t.fd(40)
        t.circle(20,180)
        t.right(90)
        t.circle(20,180)
        t.fd(40)
        t.left(45)
        t.end_fill()
        t.up()
    
    t.up()
    t.goto(0,-350)
    t.down()
    for i in range(8):
        aixin()
        t.left(45);t.fd(60)
    for i in range(12):
        a = t.heading()
        aixin()
        t.setheading(a)
        t.circle(240,15)
    t.right(90)
    for i in range(12):
        a = t.heading()
        aixin()
        t.setheading(a)
        t.circle(240,15)
    for i in range(8):
        aixin()
        t.right(45);t.fd(60)
        
    t.penup()
    t.goto(-150, -400)
    t.color("#2C3E50")
    t.write("Happy Mother's Day!", font=("Arial", 24, "bold"))
    
    # !
    t.color("red")
    t.goto(-250, 250)
    t.write("亲爱的妈妈,祝您母亲节快乐!", font=("楷体", 24, "bold"))
    t.goto(-250, 200)
    t.write("愿您的生活充满阳光和欢笑,", font=("楷体", 24, "bold"))
    t.goto(-250, 150)
    t.write("每一天都像春天一样温暖。", font=("楷体", 24, "bold"))
    t.goto(-250, 100)
    t.write("感谢您对我无微不至的照顾和关怀,", font=("楷体", 24, "bold"))
    t.goto(-250, 50)
    t.write("我会一直陪伴在您身边,", font=("楷体", 24, "bold"))
    t.goto(-250, 0)
    t.write("共同度过每一个美好瞬间。", font=("楷体", 24, "bold"))
    t.goto(0, -50)
    t.write("您的儿子", font=("楷体", 24, "bold"))
    
    # 隐藏画笔
    t.hideturtle()
    
    t.done()
    
    
    • 1