Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FelipeGF0101 opened this issue Jan 14, 2022 · 2 comments
Open

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

FelipeGF0101 opened this issue Jan 14, 2022 · 2 comments

Comments

@FelipeGF0101
Copy link

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")

😄👍

@AndreViniciusdeLima
Copy link

O mesmo erro aconteceu comigo.

import pygame

O pygame precisa ser iniciado

pygame.init()
pygame.mixer.music.load('02 - Dream On.mp3') # coloquei o mesmo nome do exército, sem espaço e carácter especial
pygame.mixer.music.play()
Input ()
pygame.event.wait()

@mateusadada
Copy link

Olá, pessoal.

Abaixo a maneira de como consegui executar a música (o mp3 precisa estar no mesmo diretório):

import pygame

print('\nBem-vindo ao programa que reproduz uma música!')

pygame.init()
pygame.mixer.music.load('exercise_021.mp3')
pygame.mixer.music.play()

input('\nTocando a música \033[33mJourney - Dont Stop Believin\033[m')

Atenciosamente,

Mateus Adada

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants