Skip to content

Python/mundo 1 - Exercício 021. #15

@FelipeGF0101

Description

@FelipeGF0101

Olá Guanabara...

A sua resolução do exercício 021, mundo 1, não deu certo pra mim.

import pygame
# O pygame precisa ser iniciado
pygame.init()
pygame.mixer.music.load('02 - Dream On.mp3') # Tentei com vários arquivos diferentes
pygame.mixer.music.play()
pygame.event.wait()

Apresentou os seguintes erros:

File "c:\Users\yurif\Desktop\PROGRAMAÇÃO GERAL\Guanaraba - Python mod1\021.py", line 24, in <module>
    pygame.event.wait()
pygame.error: video system not initialized

pygame 2.1.2 (SDL 2.0.18, Python 3.10.0)
Hello from the pygame community. https://www.pygame.org/contribute.html

Caso alguém tenha tido o mesmo problema, eu encontrei a seguinte forma de reproduzir o arquivo mp3:

Instalação: pip install playsound
from playsound import playsound
playsound("nome_do_arquivo.mp3")

😄👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions