From the course: Python for Students

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Drawing a circle with Python

Drawing a circle with Python - Python Tutorial

From the course: Python for Students

Drawing a circle with Python

- [Instructor] For this lesson, we're going to learn how to draw circles using turtle, Python's built-in drawing feature. Whenever we want to use turtle, the first thing we need to do is import it into our program and we'll do that on the first line. Then we're going to create a drawing screen using the screen function, we'll set the background color of the screen to blue and we're going to add a title called Drawing Circles Practice. I've also already created a turtle using the turtle function, and I've set our pen size to five just to make it a little bit thicker. In order to draw a circle, we're just going to use the circle function. So we can do my_turtle.circle, and then we pass in the radius size of the circle that we want to create. Let's add turtle.done to let the program know that we're done. Save it and let's run it. As you can see, it drew a 100 radius circle starting from the middle of the drawing screen. What if we wanted to fill that circle? Well, to do that, we're going…

Contents