Hello, my name is Manuel and I run ManyProgramming™. Today I will be showing you how to use Turtle Graphics in Python. It is a pretty simple feature until you start getting to letters, and implementing it into a program. This blog will not be very long and will only introduce you to the basic and simplest features of Turtle Graphics like filling a shape, making a shape and lot’s of other things! We will also right words on turtle graphics. It’s pretty simple!
Firstly, I will show you how to make a simple shape, like a square. The idea is to use the curser (in Python) to draw the shape. You can also fill the shape and draw more complex shapes like circles and such.
>>> import turtle as t
>>> t.forward(50)
>>> t.left(90)
>>> t.forward(50)
>>> t.left(90)
>>> t.forward(50)
>>> t.left(90)
>>> t.forward(50)
>>> t.left(90)
Now, you may think I’m a bit strange but if you were to type this into Python, then Turtle Graphics will automatically open and will start drawing by every line of code you say. When I write ‘import turtle as t’ at the beginning, the ‘t’ is only the nickname and can be anything as long as it doesn’t have a space and, in my opinion, is short because if it’s long, then what’s the point of giving it a nickname. However, if you do give it a nickname then you have to use the nickname before you the commands; e.g. my nickname is t so I do t.forward. If me nickname was lok, then I would have to do lok.forward because it follows what my nickname is. If you don’t want to have a nickname, then you can just write ‘import turtle’ and then you will have to write turtle.forward instead of an optional nickname!
Now, you can go in any direction. The options are ‘forward’, ‘right’, ‘left’ and ‘backward’ for moving the curser and manually drawing the shapes. Now you have a huge amount of different codes in Turtle Graphics and if you’de like to see all of them then Click Here!
Next up, we will be making circles and other shapes that aren’t as easy to make with a cursor. Note: If you would like to make an equilatorial triangle, all you have to do is go left(60) / right(60) and the length has to be the same! We will also be filling up the shape.
>>> import turtle as t
>>> t.color('red')
>>> t.begin_fill()
>>> t.circle(100)
>>> t.end_fill()
Now we will get a circle with the radius of 100 and it will be filled with red. If anything is wrong or if there is anything you don’t understand then email: programmingmany@gmail.com. You can change the size of the circle by changing the number after ‘t.circle’. I used red because I know it works but many colors work. If you are unsure whether a color works or not than contact me and I will figure it out for you. Note: Wherever you curser is facing on turtle graphics, the shape will always be on the left e.g. your curser if facing your right, then the shape will be above the curser & vice-versa.
If you want to clear your Turtle Graphics then do ‘.clear()’. Obviously you need to put the nickname you gave it or turtle before the dot as I explained above but other than that if will clear the whole turtle graphics.
Lastly, we will be writing on Turtle Graphics. This isn’t the most handy but might come in handy if you are trying to make a poster for example, or a sign, or anything that uses writing. It’s again, pretty simple.
>>> import turtle as t
>>> t.color('orange')
>>> font=("Verdana", 15, 'normal', 'bold', 'italic', 'underline')
>>> t.write('ManyProgramming Blog')
Now there will be a piece of writing on the Turtle Graphics saying ManyProgramming Blog. It will be in orange because I told Python BEFORE to make it orange and it will be bolg, italic and underlined. You can also change the font. The default font is Arial but I changed it to Verdana. Yet again, if you have any concerns about fonts or anything else just contact me.
If you were to insert this into a piece of quiz, then you could have pictures on your python quiz. However, I don’t think you are able to use Turtle Graphics in most Python Frameworks when making a website so we might have to go over another one.
Thank you for reading my blog and I really hope it made your day. If you have any worries, for the last time, Contact me at: programmingmany@gmail.com. Also, get ready for my Christmas blog because it’s coming out on the 24th December at 7:00pm.If you would like to see my book reviews blog than Click Here!




