banner



Python Turtle Draw A Circle

How to draw circle in Python Turtle

To draw a circle, we will use circle() method which takes radius as an argument.

#Program to draw circle in Python Turtle import turtle   t = turtle.Turtle() t.circle(50)

Output of the above program

Circle in Python Turtle

Explanation of the above code

import turtle t = turtle.Turtle()

You must import turtle module in order to use it. Then, we have created a new drawing board and assigned it to an object t.

t.circle(50)

It will draw a circle of radius 50units.

Draw Tangent Circles in Python Turtle

More than one circle having one point of intersection is called tangent circles.

#Program to draw tangent circles in Python Turtle import turtle   t = turtle.Turtle() for i in range(10):   t.circle(10*i)

Output of the above program-

Tangent Circles in Python Turtle

Explanation of the above code

for i in range(10):   t.circle(10*i)

After drawing a circle, turtle reaches the same point from where it has started drawing a circle. So, just by varying the radius we can obtain tangent circles. This thing is repeated 10 times to obtain tangent circles.

Draw Spiral Circles in Python Turtle

Circles with varying radius are called spiral.

#Program to draw spiral circles in Python Turtle import turtle   t = turtle.Turtle() for i in range(100):   t.circle(10+i, 45)

Output of the above program-

Spiral Circles in Python Turtle

Explanation of the above code

for i in range(100):   t.circle(10+i, 45)

The second argument of circle() method helps in drawing an arc. It controls the measure of the central angle. Here we have passed 45 as a central angle. This thing is repeated 100 times to obtain concentric circles.

Draw Concentric Circles in Python Turtle

Circles with different radii having a common center are called concurrent circles.

#Program to draw concentric circles in Python Turtle import turtle   t = turtle.Turtle() for i in range(50):   t.circle(10*i)   t.up()   t.sety((10*i)*(-1))   t.down()

Output of the above program-

Concentric Circles in Python Turtle

Explanation of the above code

for i in range(100):   t.circle(10*i)   t.up()   t.sety((10*i)*(-1))   t.down()

After drawing a circle, we have picked up the turtle's pen and set the y coordinate of turtle's pen to -1 times 10*i. After which we have put the pen back on the canvas. This thing is repeated 50 times to obtain concentric circles.

Recommended Posts

  • Python Turtle Programming Tutorial
  • How to draw square and rectangle in Python Turtle?
  • How to draw color filled shapes in Python Turtle?
  • How to draw stars in Python Turtle?
  • How to draw pentagon, hexagon and other polygons in Python Turtle?
  • How to draw Olympics logo in Python Turtle?
  • How to draw a spiral square and star in Python Turtle?
  • How to draw spider web in Python Turtle?
  • How to draw car in Python Turtle?
  • How to draw snowman in Python Turtle?
  • How to draw chessboard in Python Turtle?
  • How to draw tally marks in Python Turtle?

Python Turtle Draw A Circle

Source: https://www.tutorialsandyou.com/python/how-to-draw-circle-in-python-turtle-7.html

Posted by: meaghercasere1999.blogspot.com

0 Response to "Python Turtle Draw A Circle"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel