Draw The CRED Logo Using Python Turtle

CRED Logo using Python Turtle

Introduction

Hello Folks, Welcome to violet-cat-415996.hostingersite.com. In this tutorial, we’ll look at creating a CRED Logo Using Python Turtle. This will be a very short but fascinating article, especially for newbies, because we have commented on every line of code so that even a beginner can understand the concept.

To create a CRED logo, we divided the program into five sections to make it easier to grasp.

Explanation of Code!

Step 1. Importing Libraries

import turtle

We will use the turtle module, which you must import, to create a Turtle() Function. Turtle is an in-built Python module that allows users to manipulate a pen to draw on the screen.

Step 2. Set the background Color for Canvas

turtle.Screen().bgcolor("black")

Here we use Screen() and Bgcolor() Function to set the background color.

Step 3. Creating an object of the turtle

t=turtle.Turtle()

Step 4. Creating Outer Layer of CRED logo

t.goto(-166,100)
#goto(): This method is used to move the turtle to an absolute position.
t.width(5)
#width(): Set the pen size.
t.color("white")
#color(): Set the pen color.
t.forward(256)
#forward(): Move the turtle forward by the specified distance, in the direction the turtle is headed.
t.right(90)
#right(): Turn turtle right by angle units.
t.forward(220)
t.right(60)
t.forward(150)
t.right(60)
t.forward(150)
t.right(60)
t.forward(220)

To Create A Pentagon First we go to the location(-166,100). Set the pen size to 5 and the pen color to white. After that, we use the forward() and Right() Function To draw each line of a pentagon.

Step 5. Creating the Inner Lines(part 1)

t.penup()
#penup(): Pull the pen up – no drawing when moving.
t.goto(-86,50) 
t.pendown()
#pendown(): Pull the pen down – drawing when moving.
t.right(90)
t.forward(136)
t.right(90)
t.forward(60)
t.color("black")
t.forward(40)
t.color("white")
t.forward(40)
t.right(60)

t.forward(104)
t.right(60)
t.forward(104)
t.right(60)
t.forward(106)
t.right(90)
t.forward(130)

 Creating Inner liner we respectively use forward and right functions to draw lines.

Step 6. Creating the Inner Lines(part 1)

t.penup()
t.goto(10,-75)
t.pendown()
t.right(150)
t.forward(57)
t.right(60)
t.forward(57)
t.right(60)
t.forward(30)
t.penup()
t.goto(-163,-300)
t.pendown()

In this section, we will draw the inner three lines to complete the CRED logo.

Step 7. Adding Name!

t.write("CRED",font=("Sentic",65,"normal"))
turtle.done()

Source Code to draw CRED Logo using Python Turtle:

import turtle
turtle.Screen().bgcolor("black")
t=turtle.Turtle()
t.goto(-166,100)
t.width(5)
t.color("white")
t.forward(256)
t.right(90)
t.forward(220)
t.right(60)
t.forward(150)
t.right(60)
t.forward(150)
t.right(60)
t.forward(220)

t.penup()
t.goto(-86,50)
t.pendown()
t.right(90)
t.forward(136)
t.right(90)
t.forward(60)
t.color("black")
t.forward(40)
t.color("white")
t.forward(40)
t.right(60)

t.forward(104)
t.right(60)
t.forward(104)
t.right(60)
t.forward(106)
t.right(90)
t.forward(130)
 

t.penup()
t.goto(10,-75)
t.pendown()
t.right(150)
t.forward(57)
t.right(60)
t.forward(57)
t.right(60)
t.forward(30)
t.penup()
t.goto(-163,-300)
t.pendown()


t.write("CRED",font=("Sentic",65,"normal"))

turtle.done()

Output:

CRED Logo using Python Turtle
Draw The CRED Logo using Python Turtle

Thank you for reading our post. Please leave us a comment on how you found it. Please visit violet-cat-415996.hostingersite.com for additional turtle lessons.


Also Read:

Share:

Author: Ayush Purawr