Python Turtle Tutorial 101

In this tutorial, we will learn about Python Turtle and we will also cover different examples related to Pythonturtle. And, we will cover these topics which are mentioned below:

Table of Contents

  • Draw Spiraling Star using Turtle in Python
  • Python – Draw “PTP” logo using Turtle Graphics
  • Draw moving object using Turtle in Python
  • Draw a Tic Tac Toe Board using Python-Turtle
  • Draw Chess Board Using Turtle in Python
  • Draw Panda Using Turtle Graphics in Python
  • Draw Clock Design using Turtle in Python
  • Create digital clock using Python-Turtle
  • Draw Circle in Python using Turtle
  • Create digital clock using Python-Turtle
  • Wishing Happy New Year Using Python Turtle

Introduction to Python Turtle

In python, the turtle module is used to draw shapes and pictures. Nowadays it is more popular among the kids like it provides the most introducing ways to learn program.

The turtle is the on-screen pen that is used for drawing and moving using functions like a turtle.forward(), turtle.left(), etc.

Example1:

import turtle

# moves the pen in the
# forward direction by
# 100 pixels

turtle.forward(100)
# changes the direction of
# the pen by 10 degrees in the
# left direction
turtle.left(100)

# moves the pen in the
# forward direction in
# the new direction by
# 100 pixels

turtle.forward(100)
turtle.hideturtle()

Output:

Python Turtle tutorial Example
Python Turtle Example

Example2:

In the following code, we will draw a smiling face with the help of a turtle which spread happiness all around us. The turtle() method is used to make objects. We can draw different shapes with the help of a turtle.

  • turt.title(“Pythontpoint”) is used to give the title to the window.
  • turtle.fillcolor(color) is used to fill the color inside the shape.
  • turtle.circle(radius) is used to draw the shape of a circle.
  • turtle.down() is used to start drawing the shape.
  • turtle.up() is used to stop the drawing.
  • turtle.end_fill() is used to end filling color.
  • turtle.goto(-40, 120) is used to move the turtle to its accurate position.
  • turtle.right(90) is used to move the turtle in the right direction.
  • turtle.hideturtle() is used for hiding the turtle from the screen.
from turtle import *
# Python program to draw smile
# face emoji using turtle
import turtle as turt
turt.title("Pythontpoint")
 
# turtle object
turtle = turt.Turtle()
 
# function for creation of eye
def eyes(color, radius):
    turtle.down()
    turtle.fillcolor(color)
    turtle.begin_fill()
    turtle.circle(radius)
    turtle.end_fill()
    turtle.up()
 
 
# draw face
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()
turtle.up()
 
# draw eyes
turtle.goto(-40, 120)
eyes('white', 15)
turtle.goto(-37, 125)
eyes('blue', 5)
turtle.goto(40, 120)
eyes('white', 15)
turtle.goto(40, 125)
eyes('blue', 5)
 
# draw nose
turtle.goto(0, 75)
eyes('red', 8)
 
# draw mouth
turtle.goto(-40, 85)
turtle.down()
turtle.right(90)
turtle.circle(40, 180)
turtle.up()
 
# draw tongue
turtle.goto(-10, 45)
turtle.down()
turtle.right(180)
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(10, 180)
turtle.end_fill()
turtle.hideturtle()
turt.done()

Output:

After running the above code we get the following output in which we can see that a smiling face is drawn with the help of a turtle. The smiling face spread happiness all around. After seeing this smiling face the user also smiles once.

In this smiling face first, we create an eye after completing the eye then we draw the face after that we create a nose when the shape of the nose is perfectly drawn then we create the mouth of the emoji and after that, we create a tongue.

Python turtle smiling face

So, in this tutorial, we discussed Python Turtle and we will be covering all the Table of Contents using different examples related to its implementation.

Installation of turtle module

To install the turtle module we need to follow the command:

pip install turtle

Do Follow:

3 thoughts on “Python Turtle Tutorial 101”

Leave a Comment