鱼C论坛

 找回密码
 立即注册
查看: 931|回复: 5

求解

[复制链接]
发表于 2024-10-28 18:53:40 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
improt turtle
tmprot time

#设置名字和祝福语
name = "your name"
message = "Happy Borthday"

#初始化Turtle
turtle.bgcolor("white")
turtle.speed(0)
turtle.color("red")
turtle.begin_fill()

#绘制爱心函数
def draw_heart():
    turtle.left(140)
    turtle.forward(180)
    turtle.circle(-90, 200)
    turtle.setheading(60)
    turtle.circle(-90, 200)
    turtle.forward(180)
    turtle.end_fill()

#绘制名字函数
def draw_name():
    turtle.penup()
    turtle.goto(-200, -100)
    turtle.pendown()
    turtle.write(message, font=("Arial", 14, "bold"))

#主函数
def main():
    while True:
        draw_heart()
        draw_name()
        draw_message()
        time.sleep(1)
        turtle.clear()

#运行主函数
if name == " main ":
    turtle.hideturtle()
    main()
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2024-10-28 20:29:48 | 显示全部楼层
FishC 发表于 2024-10-28 19:05
这段代码中有几个错误和需要改正的地方。以下是修复后的代码:

没有你所说的效果
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-10-21 03:53

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表