Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

PYTHON 3.0 MAKE A HEART

# 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):
  
        # Defining step by step curve motion
        pen.right(1)
        pen.forward(1)
  
# Defining method to draw a full heart
def heart():
  
    # Set the fill color to red
    pen.fillcolor('red')
  
    # Start filling the color
    pen.begin_fill()
  
    # Draw the left line
    pen.left(140)
    pen.forward(113)
  
    # Draw the left curve
    curve()
    pen.left(120)
  
    # Draw the right curve
    curve()
  
    # Draw the right line
    pen.forward(112)
  
    # Ending the filling of the color
    pen.end_fill()
  
# Defining method to write text
def txt():
  
    # Move turtle to air
    pen.up()
  
    # Move turtle to a given position
    pen.setpos(-68, 95)
  
    # Move the turtle to the ground
    pen.down()
  
    # Set the text color to lightgreen
    pen.color('lightgreen')
  
    # Write the specified text in 
    # specified font style and size
    pen.write("GeeksForGeeks", font=(
      "Verdana", 12, "bold"))
  
  
# Draw a heart
heart()
  
# Write text
txt()
  
# To hide turtle
pen.ht()
Comment

PREVIOUS NEXT
Code Example
Python :: python substitute multiple letters 
Python :: sort arr python 
Python :: lexicographic order python 
Python :: update queryset in django 
Python :: matplotlib location legend 
Python :: TypeError: strptime() argument 1 must be str, not Series 
Python :: python request response json format 
Python :: get only every 2 rows pandas 
Python :: make the program title a name python 
Python :: python unzip a zip 
Python :: imread real color cv2 
Python :: pil crop image 
Python :: Export a Pandas dataframe as a table image 
Python :: python code to receive gmail 
Python :: python vs c++ 
Python :: python list unique in order 
Python :: image on jupyter notebook 
Python :: for i in a for j in a loop python 
Python :: Double-Linked List Python 
Python :: how to fill nan values in pandas 
Python :: python subprocess print stdout while process running 
Python :: Python Tkinter ListBox Widget 
Python :: how to find last index of list in python 
Python :: plot using matplotlib 
Python :: Python NumPy copyto function Syntax 
Python :: python how to print input 
Python :: create django group 
Python :: python ordereddict reverse 
Python :: train_test_split sklearn 
Python :: how to save an image with the same name after editing in python pillow module 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =