Pygame Wont Let Me Draw A Circle Error argument 3 must be sequence of length 2, not 4

Viewed 272

I am trying to draw a circle with pygame but I keep getting this error

error  argument 3 must be sequence of length 2, not 4
class circle:
    def __init__(self,x,y,height,width,color):
        self.x =x
        self.y = y
        self.height = height
        self.width  = width
        self.color = color
        self.rect = pygame.Rect(x,y,height,width)
    def draw(self):
        self.rect.topleft = (self.x,self.y)
        pygame.draw.circle(window,self.color,self.rect,20)
circle1 = circle(300,200,20,20,white)
2 Answers

The 3rd argument of pygame.draw.circle is the center point of the circle, rather than a rectangle:

pygame.draw.circle(window,self.color,self.rect,20)

pygame.draw.circle(window, self.color, self.rect.center, 20)

For pygame circles, you need pygame.Rect(radius,height,width).

The x and y are for rectangles.

Related