Learn Before
  • Drawing Shapes in Pygame

Drawing Ellipses in PyGame

The draw.ellipse() function allows you to draw an ellipse. The function takes in the surface, color, rectangle that will bound the ellipse, and optional width. The width is used to determine line thickness or if the ellipse should be filled. When the width is 0, the ellipse will be filled. If it's greater than 0, it will determine the thickness of the line. If it's less than 0, nothing will be drawn.

displaySurface = pygame.display.set_mode((1920, 1080)) displayColor = (0, 0, 0) rect = pygame.Rect(30, 30, 60, 60) width = 0 #the ellipse will be contained inside the rectangle stored in rect variable pygame.draw.circle(displaySurface, displayColor, rect, width)

0

1

4 years ago

Tags

Python Programming Language

Data Science

Related
  • Drawing Rectangles in Pygame

  • Drawing Polygons in Pygame

  • Drawing Circles in Pygame

  • Drawing Ellipses in PyGame

  • Drawing Arcs in Pygame

  • Drawing Lines in Pygame