Answers for "Pygame add soundtrack / music"

1

Pygame add soundtrack / music

import pygame
file = 'some.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play(-1) # If the loops is -1 then the music will repeat indefinitely.
Posted by: Guest on May-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language