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

Re: [pygame] Newbie - trouble with inheritance in pygame



Sorry if it's been asked before, but why this doesn't work:

class my_font(pygame.font.Font):
    pass

while this does:

class my_sprite(pygame.sprite.Sprite):
    pass

the first gives a TypeError


One issue is that pygame.font is an extension module (that is, it
is coded in C and loaded from the shared object .so or .dll file)
whereas pygame.sprite is a regular python module.

I seem to recall that pygame.Rect used to be the same way, and
there was a UserRect that could be subclassed.... Hmm. Maybe
Font just needs to be rewritten as a new-style class?

Sorry, hopefully someone more knowledgeable will answer also :o)

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail