I tried running your code and don't hear anything playing. I added back pygame.mixer.init() before pygame.init() in your code, and it played.
-- Clare ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Mallett Sent: Wednesday, October 10, 2007 4:18 PM To: [email protected] Subject: Re: [pygame] pygame.init before pygame.mixer.init? The simplest thing to do is: --------------------------------------- import pygame from pygame.locals import * pygame.init() sound = pygame.mixer.Sound("bark.wav") sound.play() while pygame.mixer.get_busy (): pass --------------------------------------- ...because "pygame.locals" is everything you'll need: the keys module, surfaces, sound, etc. This way you don't have to do one line of code for every submodule you want to import: -------------------------------- import pygame.key import pygame.mixer import pygame.draw import pygame.image import pygame.font import pygame.mouse --------------is = to:------------------- from pygame.locals import * ------------------------------------------- I recommend doing this. I've been programming many times and realized that I hadn't imported all the necessary modules. Opps. Especially for simplicity, use "from pygame.locals import *" Anyway, about your question: Your first line, "pygame.mixer.init()" imports pygame.mixer (you can't init a non-loaded module), and then inits it. Your next line, "pygame.init()" inits all of the imported modules and pygame. So, here's what your code is doing: pygame.mixer.init() #imports pygame.mixer and inits pygame.mixer pygame.init () #inits all imported modules and pygame. (This re-inits pygame.mixer) One way to check would be to change the first line: ----------------------------- pygame.mixer.init() -----becomes---------- import pygame.mixer ---------------------------- which will still work, but would not init the module, and so would be more efficient. Ian
