Turtle : Not Coming Slow

In the above image Mr.Turtle is looking so angry, but don't worry Mr.Turtle, in this blog post we will talk about you, and your family member python...
Python has many family members (libraries) and one of the Graphical User Interface library of python is Turtle Graphics. Have you ever seen Animal Planet and Discovery channels on TV? There discoverers like to discover real pythons and turtles. On the other hand, kids like drawing and coloring them on paper, but programmers are fond of giving commands to computer via python and turtle, and then they make something out of that.
Yes, you guessed right! Today we'll have a look at Python Turtle Graphics, so let's begin...
Below is a code, which outputs a car and some scenery around it, (Not a real one, just on the screen!)

# -*- coding: utf-8 -*-

from turtle import *

#code for drawing car begins

pensize(10)
color("red","black")

begin_fill()
forward(150)
print(pos())
sety(100)
print(pos())
left(90)
right(90)
forward(100)
right(90)
fd(100)
left(90)
fd(170)
right(90)
fd(70)
right(90)
fd(70)
circle(30)
fd(270)
circle(30)
fd(80) #same as forward
right(90)
fd(70)
#code for drawing car ends

#code for drawing sun begins
penup()
end_fill()  
fd(200)
pendown()
begin_fill()
color("yellow", "orange")
circle(50)
end_fill()
#code for drawing sun ends

#code for drawing clouds begins
penup()
fd(30)
pd()
begin_fill()
color("blue")
circle(30)
right(90)
circle(50)
right(90)
circle(70)
right(90)
circle(30)
end_fill()

penup()
fd(-500)
pd()
begin_fill()
color("blue")
circle(30)
right(90)
circle(50)
right(90)
circle(70)
right(90)
circle(30)
end_fill()

penup()
right(180)
pd()
begin_fill()
color("blue")
circle(30)
right(90)
circle(50)
right(90)
circle(70)
right(90)
circle(30)
end_fill()
#code for drawing clouds ends

done()

OUTPUT:



NOTE: The phrase used in the title of this blog post : "NOT COMING SLOW" is not mine, it is from the friend of Famous Pakistani youtuber naming "Irfan Junejo".

Comments

Popular posts from this blog

An Interview with Pakistani Data Scientist : Dr. Zeeshan Ul Hassan Usmani

A Survey of the Final Year University Students

1-Machine Learning : Start...

Data Engineering Tools

Habits to adopt in the freshman year

How to shape your career in the freshman year?

UI / UX Designs

Why to get straight A's in the freshman year ?

Good Pieces of Advice for Freshers

7 Semesters Learning Experience : Do's and Don'ts