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:
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:
- Simple Code to compare Speed of Python, Java, and C++?
- Falling Stars Animation on Python.Hub October 2024
- Most Underrated Database Trick | Life-Saving SQL Command
- Python List Methods
- Top 5 Free HTML Resume Templates in 2024 | With Source Code
- How to See Connected Wi-Fi Passwords in Windows?
- 2023 Merry Christmas using Python Turtle
- 23 AI Tools You Won’t Believe are Free
- Python 3.12.1 is Now Available
- Best Deepfake Apps and Websites You Can Try for Fun
- Amazon launched free Prompt Engineering course: Enroll Now
- 10 GitHub Repositories to Master Machine Learning
- Hello World in 35 Programming Languages
- How to Scrape Data From Any Website with Python?
- Become Job Ready With Free Harvard Computer Science course: Enroll Now
- Free Python Certification course from Alison: Good for Resume
- Download 1000+ Projects, All B.Tech & Programming Notes, Job, Resume & Interview Guide, and More – Get Your Ultimate Programming Bundle!
- Udacity Giving Free Python Course: Here is how to Enroll
- Love Babbar’s Income Revealed
- Top 5 Websites to Learn Programming in 2024
- Python Internship for college students and freshers: Apply Here
- Microsoft Giving Free Python Course in 2023: Enroll Now
- Top 5 Free Python Courses on YouTube in 2024
- Complete Python Roadmap for Beginners in 2024
- New secrets to Earn money with Python in 2024
- Connect with HR Directly – Job Hack
- Google offering free Python course: Enroll Today
- What is an AI Tool?
- Google Internship 2024
- TCS Launched Free Certification Course with Industry Recognized Value