Having fun learning Python and Turtle Module

Having fun learning Python and Turtle Module

Tags :

Category : code Python

Spirals with Turtle module

I’ve started to learn Python and during this process I’ve found the turtle module, that turned out to be a funny way to practice my recent acquired abilities to write flow control, function declaration, working with random library and so on.

I’ve enjoyed it so much that I’ve decide to create a little animation and share this with the world! I definitely indicate the Turtle module for Python students, specially for kids.

So, what exactly is the Turtle module? It’s a popular way for introducing programming to kids. You can control a robotic turtle starting at (0, 0) in the x-y plane. This way you can draw primitive and complex geometric forms to create animations and games. You can check out the Turtle documentation here.

My animation is a project for beginners in Python. It shows some experiments with the turtle module, like drawing some alphabet letters, changing a turtle to a GIF image and drawing a bunch of circles. It also uses the random library to change colors and circle positions randomly.

Check out also a YouTube video with the animation here!

Below you’ll find a piece of code showing the function created to draw circles with random location, radius and color. You can download the complete project in my GitHub repository here.

You can find links here to the turtle module documentation, the inspiration code to draw the alphabet with a turtle, the code example with Georgia’s spirals and a YouTube tutorial with the basic functions explained.

I hope you try out this module and have a lot of fun!! I’ll see you around!