MP3 player with Python

I know almost nothing about programming and so I have been studying new possibilities such as POO and the like.
Recently it gave me a desire to try to learn graphical Interface and also to create an MP3 player, all in Python (all yesterday).
I started looking for ways to satisfy my desire and decided to unite the two in one project, but I am having a serious problem, I am not being able to move forward or rewind a song in my player.

I don't know if I did anything wrong, but I've tried everything and I couldn't solve this annoying little problem.
I'll be leaving my source below for you to analyze.

from pygame  import mixer # Load the required library
from tkinter.filedialog import askopenfilename
from tkinter import *

musicas = []

class Reprodutor :
    def __init__ (self):
       pass

    def escolher ():
        selecionar = askopenfilename(initialdir="C:/Users/",
                           filetypes =(("Arquivo de audio", "*.mp3"),("All Files","*.*")),
                           title = "Selecione as musicas"
                           )
        musicas.append(selecionar)
        return musicas

    def reproduzir ():
        """ 
        mixer.init()
        mixer.music.load('C:/Users/Andreza/Music/Jeff The Killer Theme Song Piano Version Sweet Dreams Are Made Of Screams.mp3')
        mixer.music.play()
        """

        mixer.init()

        for item in musicas:
            musica_atual = mixer.music.load(item)
            musica_atual = mixer.music.play()

    def parar ():
        musica_atual = mixer.music.stop()

    def pausar ():
        musica_atual = mixer.music.pause()

    def retomar ():
        musica_atual = mixer.music.unpause() #Continua da local pausado


    def proxima ():
        for item in range(len(musicas)):
            musica_atual = mixer.music.load(musicas[item])
            musica_atual = mixer.music.play()
            item += 1


    def anterior ():
        for item in range(len(musicas)):
            musica_atual = mixer.music.load(musicas[item])
            musica_atual = mixer.music.play()
            item -= 1 



player = Reprodutor

janela =Tk()

janela.title("REPRODUTOR - FÉLIX LICHT") #Titulo

#Esta parte é que está com problemas
bt_escolher = Button(janela, width=20, text="ADICIONAR MUSICAS", command=player.escolher)
bt_proxima  = Button(janela, width=10, text="PROXIMA",            command=player.proxima)
bt_anterior = Button(janela, width=10, text="ANTERIOR",          command=player.anterior)

bt_escolher.place (x=10,  y=50 )
bt_proxima.place  (x=170, y=50)
bt_anterior.place (x=270, y=50)



bt_play    = Button(janela, width=10, text="PLAY",    command=player.reproduzir)
bt_pause   = Button(janela, width=10, text="PAUSAR",  command=player.pausar)
bt_stop    = Button(janela, width=10, text="PARAR",   command=player.parar)
bt_return  = Button(janela, width=10, text="RETOMAR", command=player.retomar)

bt_play.place   (x=10,  y=0)
bt_pause.place  (x=110, y=0)
bt_stop.place   (x=210, y=0)
bt_return.place (x=310, y=0)

janela.geometry("1280x720+450+350")
janela.mainloop()

If anyone can help me, I will be grateful.

Thank you

Edited:

After the modification, which was carried out based on the first response of the post, the program began to pass the song and return the song, however it does this procedure just once.

I tried to create a control system, where the item of the for, would be equated to the last element of the list, and if you true it would return to the value 0 of the lita, but neither this worked.

================================================================================

from pygame  import mixer # Load the required library
from tkinter.filedialog import askopenfilename
from tkinter import *

musicas = []
TAM     = len(musicas)

class Reprodutor :
    def __init__ (self):
       pass

    def escolher ():
        selecionar = askopenfilename(initialdir="C:/Users/",
                           filetypes =(("Arquivo de audio", "*.mp3"),("All Files","*.*")),
                           title = "Selecione as musicas",
                           #multiple = True
                           )
        musicas.append(selecionar)


        for i in musicas:
            print(i, end=" ")
            print()
        print()


        return musicas

    def reproduzir ():
        mixer.init()

        for item in musicas:
            musica_atual = mixer.music.load(item)
            musica_atual = mixer.music.play()

    def parar ():
        musica_atual = mixer.music.stop()

    def pausar ():
        musica_atual = mixer.music.pause()

    def retomar ():
        musica_atual = mixer.music.unpause() #Continua da local pausado

#Próximo e Anterior com Modificações realizadas com base na resposta do Antony Gabriel
    def proxima ():
        for item in range(len(musicas)):

            item += 1
            musica_atual = mixer.music.load(musicas[item])  
            musica_atual = mixer.music.play() 

    def anterior ():
        for item in range(len(musicas)):
            item -= 1 
            musica_atual = mixer.music.load(musicas[item])
            musica_atual = mixer.music.play()


player = Reprodutor

janela =Tk()

janela.title("REPRODUTOR - FÉLIX LICHT") #Titulo

#Esta parte é que está com problemas
bt_escolher = Button(janela, width=20, text="ADICIONAR MUSICAS",  command=player.escolher)
bt_proxima  = Button(janela, width=10, text="PROXIMA",            command=player.proxima)
bt_anterior = Button(janela, width=10, text="ANTERIOR",           command=player.anterior)

bt_escolher.place (x=10,  y=50 )
bt_proxima.place  (x=170, y=50)
bt_anterior.place (x=270, y=50)



bt_play    = Button(janela, width=10, text="PLAY",    command=player.reproduzir)
bt_pause   = Button(janela, width=10, text="PAUSAR",  command=player.pausar)
bt_stop    = Button(janela, width=10, text="PARAR",   command=player.parar)
bt_return  = Button(janela, width=10, text="RETOMAR", command=player.retomar)

bt_play.place   (x=10,  y=0)
bt_pause.place  (x=110, y=0)
bt_stop.place   (x=210, y=0)
bt_return.place (x=310, y=0)

janela.geometry("410x80+450+350")
janela.mainloop()
Author: Félix, 2017-05-10

1 answers

Funny, I just needed to move the item += 1 and item -= 1 up, and it worked quiet. It was just that, you did everything right.

def proxima ():
    for item in range(len(musicas)):
        item += 1
        musica_atual = mixer.music.load(musicas[item])
        musica_atual = mixer.music.play()



def anterior ():
    for item in range(len(musicas)):
        item -= 1 
        musica_atual = mixer.music.load(musicas[item])
        musica_atual = mixer.music.play()

To solve the breakthrough problem I changed to this:

The problem was that the variable item was going to -1, which was impossible to find a song,so it didn't come back. And the other problem is that he (item) was also incrementing the value too much, going to a nonexistent song, so no moving forward.

I also took out the for, preferred by using a variable called item.

Apparently I solved most of the problems. The only problem that I could not solve and that appears sometimes is that it does not read the song Number 1 ( which would be the second ), but it is not always.

I hope I helped.

Follows the code from where I modified :

def proxima ():
    global item #Usando uma variável de fora
    item += 1
    #print(item) # Utilizei para checar o que havia de errado.
    try:
        musica_atual = mixer.music.load(musicas[item])
        musica_atual = mixer.music.play()
    except IndexError: # Se o Index nao existir, isso vai impedir que o valor de item incremente.
        item -= 1



def anterior ():
    global item
    if item - 1 == -1: # Se for -1 ele volta não decrementa, ficando em 0.
        pass
    else:
        item -= 1
    #print(item)
    musica_atual = mixer.music.load(musicas[item])
    musica_atual = mixer.music.play()

I also changed the function escolher(), I noticed that sometimes there were some '' in the list, which made the program did not move forward / backward, and I put to start on the desktop, which for me was better (my songs are on the desktop), so I did this:

def escolher ():
    selecionar = askopenfilename(initialdir="C:/Users/%user%/desktop",
                       filetypes =(("Arquivo de audio", "*.mp3"),("All Files","*.*")),
                       title = "Selecione as musicas"
                       )
    if selecionar == '': # Se tiver '' ele não faz nada ( pass )
        pass
    else:
        musicas.append(selecionar)
 4
Author: Antony Gabriel, 2017-05-10 18:01:44