[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] subclassing rect
Antti Kaihola wrote:
> While learning the basics I ran into a subclassing issue: I couldn't
> subclass the Rect class. See the python session below.
> A related page at http://pygame.org/pcr/submissions/01062002a.html
> states: "Before Python 2.2, data types implemented in C (such as
> pygame's Rect class) couldn't be subclassed. Pete included the UserRect
> module - it's just the thinnest possible python wrapper around Rect.
> However, it would be cleaner and faster just to upgrade to python 2.2,
> and subclass the actual Rect class."
> Am I missing something?
hmm, i see. well i did add the code i thought was needed to make Rect and
Surface objects subclassable. Unfortunately doing this to C Objects is not
documented at all in the python docs (so i've been learning from example in
the python source). there must be some extra method or configuration i need
to make for them to really work. i noticed if the subclass doesn't have its
own __init__ method, you can instance the classes fine, but any new methods
you add to the class don't seem to show up, hrmmm..
i wish i could get a python extension guru on hand :]
> BTW, has anyone set up a keyword searchable archive for this mailing
> list?
ActiveState maintains a nicer web interface for mailing lists, they keep
track of pygame-users as well,
http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/pygame-users
woohoo, they even have a leaderboard :]
http://aspn.activestate.com/ASPN/Mail/Leaders/pygame-users/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org