Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python heart code

# Import turtle package
import turtle

# Creating a turtle object(pen)
pen = turtle.Turtle()

# Defining a method to draw curve
def curve():
	for i in range(200):

		#curve motion
		pen.right(1)
		pen.forward(1)

# method that draw the heart
def heart():
	# coloring
	pen.fillcolor('red')
# fill the color
	pen.begin_fill()
	#left line
	pen.left(140)
	pen.forward(113)
    #left curve
	curve()
	pen.left(120)
	# Draw the right curve
	curve()
	# Draw the right line
	pen.forward(112)
	# fill color again
	pen.end_fill()
# fill with text
def txt():
	pen.up()
	# positioning
	pen.setpos(-68, 95)
	# Move the turtle to the ground
	pen.down()
	# coloring u can also coose whatever color u wanna use
	pen.color('lightgreen')
    #write anything u want
	pen.write("Follow Paimon on Grepper", font=(
	"Verdana", 12, "bold"))


#run all the function
heart()
txt()
pen.ht()
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #heart #code
ADD COMMENT
Topic
Name
7+9 =