Antialiasing shapes in Pygame

Here's a practical solution for andreasdr's answer.

import pygame
from pygame import gfxdraw

def draw_circle(surface, x, y, radius, color):
    gfxdraw.aacircle(surface, x, y, radius, color)
    gfxdraw.filled_circle(surface, x, y, radius, color)

In order to draw antialiased filled shapes with pygame, use the module gfxdraw and draw one antialiased outline and one regular filled shape.

From https://www.pygame.org/docs/ref/gfxdraw.html:

To draw an anti aliased and filled shape, first use the aa* version of the
function, and then use the filled version.

Note that you need to import gfxdraw explicitly, i.e. from pygame import gfxdraw.