Open In App

Draw Ellipse Using Turtle in Python

Last Updated : 29 Sep, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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:

The 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




# 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)


Output :

Draw design using ellipse Shape

The 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




# 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 multiple 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()


Output :

 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads