Python Turtle Art

I was inspired to make art with Python today. Yes, really.

It came out of some coding lessons I have been preparing for two high school students. As an aside, I’ve been using Runestone Academy’s Foundations of Python Programming, modifying it to suit students who have learnt English as a second or third language.

Python Turtle module

After messing around with an example Python script for my students, I used Python’s random module to create some cool effects using a simple script. You can find the code for the script on GitHub. Feel free to download and run it – as long as you have a Python environment to run it in. uses randomised values, so each invocation will produce a unique result – and one-of-a-kind artwork. Yes, really! 😀

If you code in Python and have never used Turtle before, I highly recommend it for the sheer visual rewards it gives. Read all about what you can do with Turtle at the official Python documentation site.

Feel free to post any artwork you make using Turtle in the comments below. I would love to see it!

You can download and modify it to suit your Python environment and your preferences. My coding is by no means perfect, elegant, or efficient, so this script has much room for improvement.

For instance, you may need to change the first line which is the ‘shebang’ header, as it was written assuming it would be run on Linux using Python 3:


You may also like to change the colour of the background away from bright orange!


The ranges of the randomised values can be adjusted too:

draw_triangle(random.choice(sizelist),  \
   random.choice(colorlist), random.randint(-175, 175), \
   random.randint(-175, 175), random.randrange(0, 360, 10))

Basically you can go to town with it! After all, is open source. GNU General Public License v3.0 to be exact.

If you find any issues with it, please let me know in the comments below, or by logging an issue at the GitHub repository itself.

Happy creating!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: