Fundamentals 7 min read

Drawing a Corgi and a Heart with Python Turtle

This tutorial teaches how to use Python's Turtle library to draw a corgi, a single dog illustration, and a decorative heart by explaining canvas setup, pen commands, movement functions, text insertion, and providing complete code examples for each step.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Drawing a Corgi and a Heart with Python Turtle

This article introduces Python's Turtle graphics library as a fun way to learn basic programming concepts while creating visual drawings such as a corgi and a heart shape.

1. Quick start – The Turtle module provides functions for moving a virtual pen on a coordinate plane. Import the library with:

from turtle import *

The default origin (0,0) is at the center, and the pen initially faces east (0°).

2. Canvas and pen settings – You can control the canvas size, background color, and pen attributes:

screensize(800, 600, "white")
setup(600, 600)
pensize(3)
color("red")

Functions such as home() , clear() , reset() , hideturtle() , and showturtle() manage the drawing environment.

3. Movement commands – Basic motion includes forward, backward, left, right, and absolute positioning:

fd(100)   # move forward 100 units
bd(50)    # move backward 50 units
right(90) # turn right 90°
left(45)  # turn left 45°
goto(200, -150) # jump to (200, -150)

Other useful commands are stamp() (draw the turtle shape) and undo() (revert the last action).

4. Pen control – Use pd() to put the pen down (draw) and pu() to lift it (move without drawing). dot(diameter, color) draws a filled circle at the current position, and circle(radius, extent) draws arcs or full circles.

5. Inserting text – The write() function adds text with alignment and font options:

write("EESAST the best!", align="right", font=("华文隶书", 20, "bold"))

Alignment can be "left" , "center" , or "right" .

6. Drawing the corgi (single dog) – The face is created by combining straight lines and quarter‑circle arcs:

pd()
fd(25)
circle(100, 90)
circle(120, 90)
fd(10)
circle(120, 90)
circle(100, 90)
fd(25)
pu()

Eyes are drawn with goto() , begin_fill() , circle() , and end_fill() . The mouth and ears are added similarly with additional arcs.

7. Drawing a heart – By adjusting the heading and using a series of arcs, a heart shape is produced:

size = 90
pu(); goto(0, -100); pd()
begin_fill()
seth(150); fd(size)
circle(-3.74*size, 45)
circle(-1.43*size, 165)
left(120)
circle(-1.43*size, 165)
circle(-3.74*size, 45)
fd(size)
end_fill()

The pen color is set to red and the fill color to pink to complete the heart.

By following these steps and the provided code snippets, readers can easily create the illustrated corgi and heart, gaining hands‑on experience with Python Turtle graphics.

GraphicsPythontutorialProgramming Basicsturtle
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.