0

I am trying to make an audio-player in python but I can't make it work with the progress bar with the song playing at the same time. I don't know if I need make the clock or how implement the song in the progress bar.

def progress():
    if pb['value'] < 100:
        pb['value'] += 10
progress=ttk.Progressbar(window, orient=HORIZONTAL, cursor='hand2',
                         length=780,).place(x=95, y=500)```

I get the song of the listbox:

listBox=tk.Listbox(window, fg='cyan', bg='black', selectbackground='magenta', width=100, font=('ds-digital', 30))
listBox.place(x=80, y=6, width=550, height=370)

Screenshot of audio-player:

Screenshot

martineau
  • 119,623
  • 25
  • 170
  • 301
  • You haven't shown how you're playing the song, by you *may* be able to use the universal widget method [`after()`](https://tkdocs.com/shipman/universal.html) to set up periodic calls to your `progress()` function to update the progressbar (which wouldn't require multithreading). See [this answer of mine](https://stackoverflow.com/a/72034488/355230) to another question for an example of using it. – martineau Apr 28 '22 at 03:51
  • ```listBox=tk.Listbox(window, fg='cyan', bg='black', selectbackground='magenta', width=100, font=('ds-digital', 30)) listBox.place(x=80, y=6, width=550, height=370)``` – Salvatore Van Cleff Apr 28 '22 at 04:08
  • soorry XD but i get the song to the once listbox.... you were referring to that? – Salvatore Van Cleff Apr 28 '22 at 04:10
  • 1
    No, that is not what I meant. Once a song file has been selected, how is it being played so you can hear it? `tkinter` does not provide anyway of doing that itself. – martineau Apr 28 '22 at 08:21
  • @martineau ooook ok i undestand XD I get mp3 of the mutagen ```import pygame from pygame import mixer import random import mutagen from mutagen.mp3 import MP3 import time import threading window = tk.Tk() window.title("Tejon's Bar player") window.geometry("900x600") window.resizable(width=False, height=False) window.config(bg='black') style=ttk.Style() rootpath="C:\\Users\\Victor\\Music\\mi musica" Pattern="*mp3" mixer.init() ``` – Salvatore Van Cleff Apr 29 '22 at 03:12
  • Please put the code in your question. You need to provide a [mre] of the problem. – martineau Apr 29 '22 at 07:30

0 Answers0