play music using pygame but no sound

后端 未结 5 1253
情书的邮戳
情书的邮戳 2020-12-16 02:47
import pygame
pygame.mixer.init()
pygame.mixer.music.load(\"only one.mp3\")
pygame.mixer.music.play(0)
while pygame.mixer.music.get_busy():
    pygame.time.Clock().t         


        
5条回答
  •  -上瘾入骨i
    2020-12-16 03:23

    import winsound
    winsound.PlaySound(filename [as string with path if necessary], flag [integer z.B. 1 for asynchronous] )
    

    This works fine with Windows 8 and Python 2.7.6 and *.wav files

    The different flags you can check if you type winsound. and look for the autofill list.
    The flags are like SND_FILENAME or similar.
    If you type them into the editor like: *winsound.SND_FILENAME you get the integer to apply in the PLaySound command from above

    Have fun

提交回复
热议问题