The following is a piece of code that anyone with Python 3.0+ installed can run. It’s a short, simple animation. You can click on “Run” to preview what it does.

The code is as follows.


import turtle
import time


pen = turtle.Turtle()
pen.hideturtle()
pen.color('red')
pen.width(10)

pen.up()
pen.setpos(0, -50)
pen.down()


def draw_heart():
    pen.fillcolor('pink')
    pen.begin_fill()
    pen.left(140)
    pen.forward(230)
    for i in range(100):
        pen.right(2)
        pen.forward(4)
    pen.left(120)
    for i in range(100):
        pen.right(2)
        pen.forward(4)
    pen.forward(220)
    pen.end_fill()


def text():
    pen.up()
    pen.color('red')
    pen.setpos(-100, -150)
    time.sleep(1)
    pen.write("I LOVE YOU", font=(
        "Ink Free", 24, "bold"))


draw_heart()
text()
time.sleep(10)
Skyguy

About Skyguy

One Comment

  • Good day! I just wish to give you a huge thumbs up for your excellent information you have got here on this post. I am coming back to your blog for more soon. Good day! I just wish to give you a huge thumbs up for your excellent information you have got here on this post. I am coming back to your blog for more soon. נערות ליווי בחולון

Sincerity
Next Post