猫史档案馆


祝福贺卡-海龟编辑器

用户:Cecilia_VentiCecilia_Venti查看:0 回复:1 评论:0 创建时间:2022-08-02T08:53:40


import turtle
import math
import random as rd


pen = turtle.Pen()


def heat():
    x = rd.randint(-330 , 100)
    y = rd.randint(-330 , 330)
    s = rd.randint(5 , 15)
    pen.penup()
    pen.goto(x,y)
    pen.seth(45)
    pen.pendown()
    pen.begin_fill()
    pen.forward((s * (math.sqrt(2))))
    pen.circle((s / (1 / (math.sqrt(2)) + 1)) , 225)
    pen.seth(90)
    pen.circle((s / (1 / (math.sqrt(2)) + 1)) , 225)
    pen.forward((s * (math.sqrt(2))))
    pen.end_fill()


def bigheat():
    pen.penup()
    pen.goto(200 , -100)
    pen.seth(45)
    pen.pendown()
    pen.begin_fill()
    pen.forward(241)
    pen.circle(100 , 225)
    pen.seth(90)
    pen.circle(100 , 225)
    pen.forward(241)
    pen.end_fill()


def text(t):
    pen.write(t , False , 'left' , ('arial' , 20))

    
pen.speed(0)
pen.color('red')
for i in range(100):
    heat()
bigheat()
pen.penup()
pen.goto(100 , -200)
text('愿各位同学:')
pen.goto(100 , -250)
text('乘风破浪会有时,')
pen.goto(100 , -300)
text('直挂云帆济沧海。')


turtle.done()


回复

上一页1 页 / 共 1下一页
Cecilia_VentiCecilia_Venti

center_image

点赞0


评论