Code

Drawing Circles in Pygame

The draw.circle() function allows you to draw a circle. The function takes in the surface, color, tuple for the xy coordinates of the center, int or float value for the radius measured from the center coordinates, and optional width. The width is used to determine line thickness or if the circle should be filled. When the width is 0, the circle 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) center = (x, y) radius = 3 width = 0 pygame.draw.circle(displaySurface, displayColor, center, radius, width)

0

1

Updated 2021-06-21

Tags

Python Programming Language

Data Science