[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Extending Surface Class



Is it possible to extend the surface class? Every time I do the
surface ends up dieing somehow right after it is created... I may just
be doing it in the wrong way, though. The main point is to override
the __str__() method, so if you know another way besides extending
pygame.Surface, I'd be happy to hear it.


class ExtendedSurface(pygame.Surface):

    def __init__(self, surface, string):
        pygame.Surface.__init__(surface, surface.get_size()) #The docs
say to include a size, etc. but that just gives me "too many values to
unpack" errors.
        self.string = string

    def __str__(self):
        return self.string



Thanks!