python turtle 002代码表白

代码:pythonturtle002表白资源-CSDN文库

python 复制代码
# 作者V w1933423
import turtle
import math

def draw_love():
    # 创建turtle画笔
    t = turtle.pen()
    t = turtle

    # 提起画笔,移动到起始位置
    t.up()
    t.goto(0, 150)
    t.down()

    # 设置颜色并开始填充
    t.color('red')
    t.begin_fill()
    t.fillcolor('red')
    t.speed(5)

    # 画红色多边形的第一部分
    t.left(45)
    t.forward(150)
    t.right(45)
    t.forward(100)
    t.right(45)
    t.forward(100)
    t.right(45)
    t.forward(100)
    t.right(45)
    t.forward(250 + math.sqrt(2) * 100)
    t.right(90)
    t.speed(2)
    t.forward(250 + 100 * math.sqrt(2))
    t.right(45)
    t.forward(100)
    t.right(45)
    t.forward(100)
    t.right(45)
    t.forward(100)
    t.right(45)
    t.forward(150)

    # 结束填充
    t.end_fill()

    # 移动画笔位置
    t.goto(-10, 0)
    t.pencolor('white')

    # 画字母'L'
    t.pensize(10)
    t.goto(-50, 0)
    t.goto(-50, 80)
    t.up()

    # 画字母'I'
    # 作者V w1933423
相关推荐
user62229864925813 分钟前
React 常用技术知识全景:从组件到 Hooks 的系统理解
前端
麻辣凉茶3 分钟前
给阿嬤一封来自云端的信(上)
前端·node.js
前端缘梦4 分钟前
LangGraph 实战:从 0 到 1 构建 AI 代码生成工作流
前端·程序员·全栈
weedsfly5 分钟前
栈和堆:JavaScript 内存的“旅馆”和“仓库”
前端·javascript·面试
用户059540174466 分钟前
大模型长上下文遗忘排查实录:用 Playwright 自动化测试,揪出了 90% 的存储序列化 bug
前端·css
3630458417 分钟前
Signal 带来的架构问题思考
前端·vue.js
达达尼昂13 分钟前
Claude : 如何设计可控的agent-loops
前端·人工智能·后端
半个落月13 分钟前
JavaScript 字符串面试题:反转、回文与双指针
javascript
IT_陈寒43 分钟前
Redis持久化丢失数据的坑,这次终于被我填平了
前端·人工智能·后端