[python]代码库
import turtle
import random
# python表白 动画画99个心形
# 画❤上半圆
def gxy():
for i in range(200):
turtle.right(1)
turtle.forward(1)
# python表白 画❤
def xin(x, y):
turtle.seth(x)
turtle.goto(x, y)
turtle.down()
turtle.begin_fill()
turtle.left(140)
turtle.forward(112)
gxy()
turtle.left(120)
gxy()
turtle.forward(112)
turtle.end_fill()
turtle.up()
# 初始化表白面板
turtle.setup(1300, 900)
#turtle.tracer(False) # 不画动画 可以立马显示结果图
turtle.color("red", "pink")
turtle.pensize(10)
turtle.speed(0)
turtle.seth(180)
turtle.hideturtle()
turtle.up()
# 画99个心
for x in range(99):
xin(random.randint(-600, 600), random.randint(-400, 400))
turtle.up()
turtle.done()
[代码运行效果截图]
高级设计师
by: Python自学 发表于:2022-10-27 03:28:30 顶(2) | 踩(1) 回复
回复评论