Draw Ellipse Using Turtle in Python

Prerequisite: Turtle Programming Basics

Turtle is an inbuilt module in Python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle (pen). To move turtle, there are some functions i.e forward(), backward(), etc.

Approach:

Following steps are used :

  • Import turtle
  • Divide the ellipse into four arcs
  • Define a method to form these arc in pair
  • Call the function.

Below is the implementation :



Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# import package
import turtle
  
# method to draw ellipse
def draw(rad):
      
  # rad --> radius of arc
  for i in range(2):
      
    # two arcs
    turtle.circle(rad,90)
    turtle.circle(rad//2,90)
  
# Main section
# tilt the shape to negative 45
turtle.seth(-45)
  
# calling draw method
draw(100)

chevron_right


Output :

Draw design using ellipse Shape

Following steps are used :

  • Import turtle
  • Set Screen
  • Divide the ellipse into four arcs
  • Define a method to form these arc in pair
  • Call the function multiple times for different colors.

Below is the implementation :

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# import package and making object
import turtle
screen = turtle.Screen()
  
# method to draw ellipse
def draw(rad):
      
  # rad --> radius for arc
    for i in range(2):
        turtle.circle(rad,90)
        turtle.circle(rad//2,90)
  
# Main Section 
# Set screen size
screen.setup(500,500)
  
# Set screen color
screen.bgcolor('black')
  
# Colors
col=['violet','blue','green','yellow',
     'orange','red']
  
# some integers
val=10
ind=0
  
# turtle speed
turtle.speed(100)
  
# loop for mutiple ellipse
for i in range(36):
      
    # oriented the ellipse at angle = -val
    turtle.seth(-val)
      
    # color of ellipse
    turtle.color(col[ind])
      
    # to access different color
    if ind==5:
        ind=0
    else:
        ind+=1
      
    # calling method
    draw(80)
      
    # orientation change
    val+=10
  
# for hiding the turtle
turtle.hideturtle()

chevron_right


Output :




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.