[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Classless Utilities?
andrew baker wrote:
I fail to see why a single Jukebox object is prohibitive. Instantiate
it at the beginning of execution, and then just use it throughout. Or,
have your list of sounds in a list in your sound module. Python handles
namespaces fairly symmetrically, so you shouldn't see much of a difference.
The reason was, think of a button. If I want a button to beep when
clicked, I'd most likely have to either pass it a reference to the
Jukebox so it can call a function, or have the function be free-standing
so it can be called from anywhere. But if I use that trick of defining
the class, then making an instance of it in the module itself, then that
works; I'll have a reference available from the main program, anywhere.
Kris