Python Labs : Simple drawing with Turtle
Well, this is for newbies to have some fun while learning Python.
In this very short article, I'm going to introduce one of the most popular modules in Python called 'Turtle' which allows you to create images using turtle graphics. Check the following drawing, say hi to Wallie.
Trust me, this is pretty easy. Turtle graphics is a popular way of introducing programming to kids. :)
The turtle module is included in most Python installations so you need not to worry about importing packages. If you have already installed Python on your computer, you should be able to run the given code sample below (refer Sample_Code_1) which will draw 'Wallie' as in Figure 1 above. If you haven't installed Python yet, I guess now is a good time to install. You can refer to my articles Let’s start with Python — Setting up the programming environment and Let’s start with Python — Say ‘Hi!’ with Python if are a newbie.
The code is self-explanatory. However, I have added some comments to make it easier but comments aren't necessary.
You can find more methods associated with Turtle module here. It is important to note that Turtle can draw intricate shapes using these methods. Also, you can write programs for drawing shapes with your mouse. By letting turtle follow your mouse, you can draw objects on the turtle screen. Thinking of creating your own paint application, not a bad idea. :) I'm not going to go through further on this module. The intention of this article is newbies to get know about Turtle. Once you know its existence, rest is up to you. Search Google and you see lots of nice artworks created with Turtle. Make yourself motivated to start coding. It's fun. Now it's your turn, spend some time learning and familiarizing yourself with the module, be creative and have fun!!
I'd like to see your amazing creations. Feel free to share what you create with me. Upload your code to https://gist.github.com and share the link below in the comment section.
If you like this article and the content that I create, you can buy me a virtual coffee ️😊;
Cheers!