Drawing an Ellipse with Pygame

Drawing an Ellipse with Pygame is just like drawing other shape, basically Pygame will stretch a circle to fit within a rectangle object specified by a tuple contains the top left corner of the rectangle and the width and height of that rectangle. Below is the entire script showing you how to draw an ellipse on the screen surface.

import pygame
from pygame.locals import *
from sys import exit

screen = pygame.display.set_mode((640, 480), 0, 32)

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
        pygame.draw.ellipse(screen, (0,255,0), (30,30,200,300))

The above script will produce the following outcome.

Pygame Ellipse
Pygame Ellipse

The pygame.draw.ellipse method takes in these parameters.

1) Screen surface to draw on it
2) Color tuple for ellipse
3) Rectangle tuple
4) An optional line width which if stated will create a hollow ellipse instead of a solid one