赞
踩
目录
- #!/usr/bin/env python3
- # _*_ coding : UTF-8 _*_
- # 开发人员 :jly
- # 开发时间 :2024/02/27 20:52:44
- # 文件名称 :python_发射爱心.py
- # 开发工具 :Visual Studio Code
-
- import turtle
- import time
- from turtle import mainloop, hideturtle
-
-
- def clear_all():
- turtle.penup()
- turtle.goto(0, 0)
- turtle.color('white')
- turtle.pensize(800)
- turtle.pendown()
- turtle.setheading(0)
- turtle.fd(300)
- turtle.bk(600)
-
-
- # 重定位海龟的位置
- def go_to(x, y, state):
- turtle.pendown() if state else turtle.penup()
- turtle.goto(x, y)
-
-
- def draw_heart(size):
- turtle.color('red', 'pink')
- turtle.pensize(2)
- turtle.pendown()
- turtle.setheading(150)
- turtle.begin_fill()
- turtle.fd(size)
- turtle.circle(size * -3.745, 45)
- turtle.circle(size * -1.431, 165)
- turtle.left(120)
- turtle.circle(size * -1.431, 165)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。