how to gfxdraw in a subclass of pygame.Surface [python/pygame]
Question: am i subclassing Surface the wrong way? the error says that gfxdraw.aacircle()
requires a Surface as 1st argument, but I can't figure out how to do that.
runnable code and exception below:

    
    
    import pygame, sys, os
    from pygame.locals import *
    from pygame import gfxdraw
    
    BLACK = (0,0,0)
    WHITE = (255,255,255)
    
    class basicButton(pygame.Surface): # basic surface for buttons
        def __init__(self, size, radius):
            pygame.Surface.__init__(self, size=(size,size))
            self.fill(BLACK)
            # anti-aliased outline
            pygame.gfxdraw.aacircle(self, radius, radius, radius,  WHITE)
            # color filled circle
            pygame.gfxdraw.filled_circle(self, radius, radius, radius,  WHITE)
            # set black to be transparent
            self.set_colorkey(BLACK)
    
    # make an instance
    quitButtonSurf = basicButton(25, 12)
    
    pygame.init()
    screen = pygame.display.set_mode((800, 600))
    
    while True:
        screen.blit(quitButtonSurf)
        pygame.display.flip()
    

throws exeption: pygame.gfxdraw.aacircle(self, radius, radius, radius, WHITE)
TypeError: surface must be a Surface


Answer: Unfortunately this isn't EXACTLY what you were looking for, but it should
work.

    
    
    import pygame, sys, os
    from pygame.locals import *
    from pygame import gfxdraw
    
    pygame.init()
    
    
    BLACK = (0,0,0)
    WHITE = (255,255,255)
    
    class basicButton: 
        def __init__(self, size, radius):
            self.image = pygame.Surface((size,size)) # as per your example, assuming a square
            self.image.fill(BLACK)
            pygame.gfxdraw.aacircle(self.image, radius, radius, radius,  WHITE)
            pygame.gfxdraw.filled_circle(self.image, radius, radius, radius,  WHITE)
            self.image.set_colorkey(BLACK)
    
    
    quitButtonSurf = basicButton(25, 12)
    
    screen = pygame.display.set_mode((800, 600))
    
    while True:
        screen.blit(quitButtonSurf.image,(0,0)) # you'll have to assign a location for this object, I set it to 0,0 simply for testing
        pygame.display.flip()
    

I hope this helped

