I have built classes for custom purposes and put the sound and channel
objects in an attribute, then exposed the methods I needed. This may
work for you.
If I recall correctly, there is a jukebox recipe under Cookbook on the
pygame.org website that does this.
Gumm
On 1/5/2015 9:59 PM, Brian Madden wrote:
Thanks Lenard,
I learned that today when I tried to subclass pygame.mixer.Channel and
it didn't work and error said I was trying to subclass a method and
not a class. :)
No need to change this on my behalf. As I wrote, my current
implementation is to have my own separate class which just references
the related pygame Channel object. So that's fine for me.
Thanks again,
Brian
On Mon, Jan 5, 2015 at 9:54 PM, Lenard Lindstrom <le...@telus.net
<mailto:le...@telus.net>> wrote:
Sprites are a little different. They are Python classes, while
Sound and Channel are extension types coded directly in C.
pygame.mixer.Sound is an actual class object, and can be
subclassed. mixer.Channel is just a function that returns a new
Channel instance. The actual Channel type has not been updated to
support subclassing. If subclassing Channel is a desired feature,
then I will fix the oversight.
Lenard Lindstrom
On 15-01-05 07:50 PM, Paul Vincent Craven wrote:
That's normal. I usually subclass Sprites every time I use
them. They even have methods set up that you are expected to
override.
Paul Vincent Craven
On Mon, Jan 5, 2015 at 4:10 PM, Brian Madden
<br...@missionpinball.com <mailto:br...@missionpinball.com>
<mailto:br...@missionpinball.com
<mailto:br...@missionpinball.com>>> wrote:
Hi Everyone!
In my app I'm making heavy use of Pygame mixer's Channels and
Sound objects. In both cases I need to add additional
methods and
attributes to them. Is my code is now, I have my own
classes of
each which reference related Pygame classes. (In other
words, my
"Channel" class has a bunch of things like the name, the
priority
of the sound that's currently playing, a reference to the
Pygame
Channel object, etc.)
My question is whether it's ok to subclass the actual
Pygame mixer
Channel and Sound classes for my use? I've never subclassed
anything from an external module before, and I guess I'm
wondering
whether that's ok to do or whether that's frowned upon?
Thanks in advance!
Brian
-- *Brian Madden*
Mission Pinball (blog <http://missionpinball.com> | twitter
<https://twitter.com/missionpinball> | MPF software framework
<http://missionpinball.com/framework> | sample games
<https://missionpinball.com/blog/category/big-shot-em-conversion/>)
--
*Brian Madden*
Mission Pinball (blog <http://missionpinball.com> | twitter
<https://twitter.com/missionpinball> | MPF software framework
<http://missionpinball.com/framework> | sample games
<https://missionpinball.com/blog/category/big-shot-em-conversion/>)