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

[pygame] pygame.mixer.music Question



Hello all!

When using pygame.mixer.music, I encountered a strange problem,
as follows:

1.The following code can be a
normal player, you can hear the music

import pygame,time
###########pygame.init()
pygame.mixer.init()
pygame.mixer.music.load('music.ogg')
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
time.sleep(0.1)

2.When add pygame.init(),Can not hear the music

import pygame,time
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load('music.ogg')
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
time.sleep(0.1)

3.But First pygame.mixer.init() are well

import pygame,time
pygame.mixer.init()
pygame.init()
pygame.mixer.music.load('music.ogg')
pygame.mixer.music.play(-1)
while pygame.mixer.music.get_busy():
    print time.ctime()
    time.sleep(0.1)

[The end]