Drawing Shapes
00:00 Drawing Shapes. Creating regular polygons is done by issuing the same command multiple times. For instance, a square has straight lines and 90-degree turns at each corner.
00:22
turtle
has a couple of preset shapes which you can make use of in your programs, the first of which is .circle()
. As you can see, it needs a radius
as a minimum, and it draws a circle for you. However, there are two other parameters that you can use, which can make things more interesting. The first is extent
, which is how far around in degrees the circle will be drawn. So here, setting it to 180
degrees, half the circle is drawn.
00:53
steps
allows you to pick how many steps the turtle will take to draw the circle. This makes it easy to draw regular polygons by setting the steps
to the number of sides you want it to have. Here, setting it to 3
draws a triangle.
01:09
Setting it to 4
draws a square, and so on. Another preset shape is the .dot()
, which takes size
and color
as its arguments.
01:19
We’ll come to color later on in the course, but for the time being, let’s enter a size
. As you can see, a filled-in circle has appeared where the turtle currently is, and we can create another one by issuing the same command again.
01:37
Now you’ve seen that turtle
can help you out by making the drawing of shapes easier. In the next section, you’ll take a look at how to alter the turtle’s appearance.
Become a Member to join the conversation.