Tutorials DSA Data Science Web Tech Courses Sign In
Draw Heart Using Turtle
Graphics in Python
Turtle is an inbuilt module in Python. It provides:
1. Drawing using a screen (cardboard).
2. Turtle (pen).
To draw something on the screen, we need to
move the turtle (pen) and to move the turtle,
there are some functions like the forward(),
backward(), etc
Prerequisite: Turtle Programming Basics
Draw Heart Using Turtle Graphics
In this section, we will discuss how to draw
Heart using Turtle Graphics.
DSA to Development Program | GeeksforG…
03:47
Approach:
1. Import Turtle
2. Make Turtle Object
3. Define a method to draw a curve with
simple forward and left moves
4. Define a method to draw the full heart
and fill the red color in it
5. Define a method to display some text
by setting position
6. Call all the methods in main section.
Code:
python3
# 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
Free Python 3 Tutorial Data Types pen.forward(112)
Control Flow Functions List String Set Tuple Dictionary Oops Exception Handling
# Ending the filling of the color
Solve Coding pen.end_fill()
Problems
# Defining method to write text
def txt():
turtle.undobu!erentries()
function in Python
# Move turtle to air
pen.up()
Draw tree using Turtle
module in Python # Move turtle to a given position
pen.setpos(-68, 95)
# Move the turtle to the ground
turtle.speed() function
pen.down() Fazer login com o Google
in Python
# Set the text color to lightgreen
turtle.isdown() pen.color('lightgreen') Use sua Conta do Google
function in Python
# Write the specified text in para fazer login no app
# specified font style and sizeGeeksforGeeks
Print a Spirograph pen.write("GeeksForGeeks", font=(
using turtle in Python "Verdana", 12, "bold")) Chega de decorar senhas. Faça
login de forma rápida, simples e
turtle.setx() function in segura.
Python # Draw a heart
heart() Continuar
Draw Square and # Write text
Rectangle in Turtle - txt()
Python
# To hide turtle
Python - turtle.delay() pen.ht()
method
Draw lines at the
Output:
Don't miss your chance to ride the wave of the
data revolution! Every industry is scaling new
heights by tapping into the power of data.
Sharpen your skills and become a part of the
hottest trend in the 21st century.
Dive into the future of technology - explore the
Complete Machine Learning and Data Science
Program by GeeksforGeeks and stay ahead of
the curve.
Last Updated : 08 Jul, 2020 48
Previous Next
turtle.home() Draw Rainbow using
function in Python Turtle Graphics in
Python
Share your thoughts in
Add Your Comment
the comments
Similar Reads
Python - Draw Python - Draw Star
Hexagon Using Using Turtle
Turtle Graphics Graphics
Python - Draw Draw Panda Using
Octagonal shape Turtle Graphics in
Using Turtle Python
Graphics
Draw Rainbow Draw Spiralling
using Turtle Circles Using Turtle
Graphics in Python Graphics in Python
Draw Colorful Draw Diamond
Spiral Web Using shape using Turtle
Turtle Graphics in graphics in Python
Python
Python - Draw turtle.forward()
"GFG" logo using method in Python-
Turtle Graphics Turtle
Complete Tutorials
Python API
Python Crash
Tutorial: Getting
Course
Started with APIs
Python
Advanced Python
Automation
Tutorials
Tutorial
OpenAI Python API
- Complete Guide
D deepansh…
Article Tags : Python-turtle , Python
Practice Tags : python
Additional Information
Company Explore Languages DSA Data HTML &
A-143, 9th Floor, Sovereign About Us Hack-A- Python Data Science & CSS
Corporate Tower, Sector-136, Thons Structures ML
Noida, Uttar Pradesh - Legal Java HTML
201305 GfG Weekly Algorithms
Careers C++ Data Science CSS
Contest DSA for With Python
In Media PHP Web
DSA in Beginners Data Science Templates
Contact Us GoLang
JAVA/C++ Basic DSA For Beginner
Advertise SQL CSS
Master Problems Machine Frameworks
with us R Language
System DSA Learning
GFG Bootstrap
Design Android Roadmap Tutorial
Corporate Tutorial Tailwind CSS
Master CP Top 100 DSA ML Maths
Solution SASS
GeeksforGeeks Tutorials Interview
Placement Data
Videos Archive Problems LESS
Training Visualisation
Geeks DSA Tutorial Web Design
Program
Community Roadmap by Pandas Django
Sandeep Jain Tutorial Tutorial
All Cheat NumPy
Sheets Tutorial
NLP Tutorial
Deep
Learning
Tutorial
Python Computer DevOps Competitive System JavaScript
Python Science Git Programming Design JavaScript
Programming Operating AWS Top DS or High Level Examples
Examples Systems Algo for CP Design TypeScript
Docker
Python Computer Top 50 Tree Low Level ReactJS
Kubernetes
Projects Network Design
Azure Top 50 Graph NextJS
Python Database UML
GCP Top 50 Array AngularJS
Tkinter Management Diagrams
DevOps Top 50 String NodeJS
Web Scraping System Interview
Roadmap Top 50 DP Lodash
OpenCV So!ware Guide
Python Engineering Top 15 Web Browser
Design
Tutorial Websites for
Digital Logic Patterns
CP
Python Design OOAD
Interview Engineering System
Question Maths Design
Bootcamp
Interview
Questions
Preparation School Management Free More GeeksforGeeks
Corner Subjects & Finance Online Tutorials Videos
Company- Mathematics Management Tools So!ware DSA
Wise Physics HR Typing Test Development Python
Recruitment Management So!ware
Chemistry Image Editor Java
Process Testing
Biology Finance Code C++
Resume Product
Social Income Tax Formatters Data Science
Templates Management
Science Organisational Code CS Subjects
Aptitude SAP
English Behaviour Converters
Preparation
Grammar Marketing Currency SEO - Search
Puzzles Engine
World GK Converter
Company- Optimization
Random
Wise Linux
Number
Preparation
Generator Excel
Random
Password
Generator
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved