0
pygame.init()
pygame.display.init
screen = pygame.display.set_mode([800, 600])
test = "space.ogg"
pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)
pygame.mixer.music.load(path.join(snd_dir, 'space.ogg'))
pygame.mixer.music.play(test)
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("My Game")
clock = pygame.time.Clock()

it comes up with an error when i try to run the code

ERROR: pygame.mixer.music.play(test) TypeError: an integer is required (got type str)

  • 1
    The error complains about a parameter being string instead of integer. Your parameter (feed from test, which is "space.ogg") is string. That seems pretty clear as error messages go. What exactly is your question? – Yunnosch Aug 21 '17 at 22:43

1 Answers1

0

play takes two arguments, loops and start, both of them defaulting to 0. No strings -- so you're giving it the wrong argument.

You pass to play method a string (space.ogg) and this is the error

Look further on the Google results and you'll see an SO question: pygame

Fady Saad
  • 1,169
  • 8
  • 13