Приложение музыкального плеера - PullRequest
0 голосов
/ 26 января 2019

Я создаю простой музыкальный плеер с использованием Python.Но при нажатии на кнопку «Воспроизвести» я не могу воспроизвести песню, но при нажатии «Остановить» сообщение: процесс, завершенный с кодом выхода 0, отображается на терминале

from tkinter import *
from pygame import mixer

window = Tk()

mixer.init()

window.geometry('300x300')  # set dimension of the window
window.title('Music Player')  # title of the window

textLabel = Label(window, text="Play Button")
textLabel.pack()

def play_song():
    mixer.music.load('Particula.mp3')
    mixer.music.play()
def stop_song():
    mixer.music.stop()

play_photo = PhotoImage(file='play.png')
playButton = Button(window, image=play_photo, command=play_song)
playButton.pack()
stop_photo = PhotoImage(file='stop.png')
stopButton = Button(window, image=stop_photo, command=stop_song)
stopButton.pack()
window.mainloop()  # responsible for all kind of updation on the window

i have the music in the project directory

1 Ответ

0 голосов
/ 01 февраля 2019

Я импортировал ваш код, и он отлично работает на моем ноутбуке.Я могу играть, а также остановить песню без каких-либо ошибок.

...