How to make Avengers Logo using Python Turtle Graphics
In this blogpost I will show you how to make famous avengers logo using python turtle graphics in python programming.
It is very easy to draw if you have knowledge about python turtle graphics.
What is Pyhon Turtle Graphics?
Turtle is a pre-installed Python library that enables users to create pictures and shapes by providing them with a virtual canvas.
You can draw anything in python turtle graphics using commands. I have also made a tracer code in python programming which allows you to trace the x and y coordinates of any image and after tracing the coordinates you can easily put these coordinates in python turtle code and draw anything you want.
Python Libraries Needed : Turtle Graphics
INSTALLATION : Turtle is a pre-installed library. If it is not pre-installed in your system then,
Run the following command in terminal or cmd pip install turtle
Source Code : Here is the source code.You can copy this code from here and paste it to your favourite editor and run this code. You will definitely amazed after seeing the amazing output.
import turtle
def draw_circle(pen):
# outer circle
pen.setposition(0, -280)
pen.pendown()
pen.begin_fill()
pen.color('red')
pen.pencolor('white')
pen.circle(300)
pen.end_fill()
pen.penup()
def draw_circle2(pen):
# inner circle
pen.pensize(2)
pen.setposition(0, -230)
pen.pendown()
pen.begin_fill()
pen.color('black')
pen.circle(250)
pen.end_fill()
pen.penup()
def draw_A(pen):
# drawing โAโ
pen.setposition(30, -110)
pen.pendown()
pen.begin_fill()
pen.color('red')
pen.pensize(10)
pen.pencolor('white')
pen.forward(23)
pen.backward(123)
pen.left(60)
pen.backward(220)
pen.right(60)
pen.backward(100)
pen.right(117)
pen.backward(710)
pen.right(63)
pen.backward(110)
pen.right(90)
pen.backward(510)
pen.right(90)
pen.backward(100)
pen.right(90)
pen.backward(70)
pen.end_fill()
pen.penup()
def draw_triangle(pen):
# Triangle shape in โAโ to make it look like 2d
pen.pensize(10)
pen.setposition(53, -40)
pen.pendown()
pen.begin_fill()
pen.color('black')
pen.pencolor('white')
pen.right(90)
pen.forward(100)
pen.right(115)
pen.forward(250)
pen.right(157)
pen.forward(227)
pen.end_fill()
def draw_arrow(pen):
# arrow
pen.backward(80)
pen.left(42)
pen.forward(147)
pen.right(83)
pen.forward(140)
if __name__ == '__main__':
win = turtle.Screen()
win.bgcolor('black')
avengers = turtle.Turtle()
avengers.speed(10)
avengers.pensize(10)
avengers.penup()
draw_circle(avengers)
draw_circle2(avengers)
draw_A(avengers)
draw_triangle(avengers)
draw_arrow(avengers)
avengers.hideturtle()
turtle.done()
Output : In the Above image I have shown you the output of the upper code.
You can use any software to run this code which supports python like PYTHON IDLE, VS CODE ,PYCHARM, ETC
My Youtube Channel : Vast Coding {Search it on youtube}
Also Read >>
Keywords/Related Searches: {Ignore}
turtle python, turtle python commands, python turtle graphics,
turtle python tutorial, turtle python example, turtle drawing python,
python turtle graphics tutorial, python turtle programming,
python turtle graphics code, turtle graphics in python, python turtle graphics download
I really enjoyed reading your contentโitโs both inspiring and well-written. As someone whoโs passionate about the same field, I found your insights incredibly valuable. We also provide similar services, and Iโd love for you to check out our website to see what we offer. Keep up the amazing work, and I look forward to reading more from you! freelance web designer in Dubai
ReplyDelete