Get creative with python using turtle!

“I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times.” -Bruce Lee

Recently, I read this famous quote and realized that exploring one language is more beneficial than learning many. While exploring python, I have learned about several amazing pre-installed modules in python like random, venv, time, textwrap, tkinter, collections, etc.

So I initiate to explore one of the most interesting modules i.e. turtle module,
turtle is a pre-installed Python library. This module gives you a pen called a turtle and a canvas to create illustrations and intricate shapes. This is an amazing module as it uses animation and makes this module more fascinating.

The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter(Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python’s de-facto standard GUI.) for the underlying graphics.

Working with the turtle module is not so laborious the only prerequisites are your basic concepts and knowledge of Python. Into the bargain, this module helps you to make your logic strong and enhance your coding skills. The turtle module is not just about facile drawing and games only, this module also sanctions you for some complex stuff and to build games by incorporating some other module like random, time, etc.

Basic functions/methods you must know:

  • forward() —forward() method is used to move the turtle. This method takes 1 argument.

Capabilities that turtle provides:

  • You can set up the size of the screen

Here I am pasting a code for making a circular pattern along with output!

from turtle import *
speed(0)
bgcolor("black")
pencolor("white")
for i in range(6):
for colors in ("gold", "violet" , "purple", "navy" , "cyan", "turquoise"):
color(colors)
circle(100)
right(10)
hideturtle()
done()
CIRCULAR RINGS
CIRCULAR RINGS
CIRCULAR RING

Here I am pasting another code for making a flower along with output!

from turtle import *
speed(0)
bgcolor("black")
pencolor("blue")
fillcolor("red")
begin_fill()
while True:
forward(400)
left(170)
if abs(pos()) < 1:#pos() return a position of (x,y) coordinates
break #abs() function return the absolute value
end_fill()
ht()#to hide turtle
done()
FLOWER

Conclusion:

Taking everything into account I suggest you to must try this amazing module. If I talk about my personal experience, I am using this module since one week and in this span, I grasp a lot about this module. I constructed many shapes which include polygons, patterns, different flowers, and all alphabets of my name. Withal now I currently try to build a snake game using this turtle.

There is a lot of stuff prevailing on the internet including YouTube from where you can learn a lot about this module, you can also go through the documentation.

Happy Coding!!!