1

I've written music player with basic functionality (play, pause, playlist) using tkinter and pygame.mixer.

Now I want to do plot that shows how many minutes you've been listening music per days of week. For this I'm using matplotlib and pandas.

I want to do it like this. When you press button "Play", program starts counting time. Then when you press "Pause" it stops counting, and pushes how many minutes has passed into csv file, or changes values which are already here.

There is buttons that I created, and want to change so they work like stopwatch and changes csv file.

def play():
    pygame.mixer.music.load(playlist.get(tkr.ACTIVE))
    var.set(playlist.get(tkr.ACTIVE))
    pygame.mixer.music.play()
    pygame.mixer.music.set_volume(Volume.get())
    print(pygame.mixer.music.set_volume())
    print(Volume.get())


def pause():
    pygame.mixer.music.pause()


def resume():
    pygame.mixer.music.unpause()

My csv file looks like this:

Jakob F
  • 1,046
  • 10
  • 23
hibana1801
  • 11
  • 3
  • 2
    Do you have a concrete question? – Jakob F Feb 11 '20 at 20:26
  • I know it's too boldly, but I'm asking for the code that counts time when I press button, or at least part of it. – hibana1801 Feb 11 '20 at 20:36
  • 1
    The [time](https://docs.python.org/3/library/time.html) module can be used for this, time.start() to start the timer, etc. What have you tired based on your own research? – G. Anderson Feb 11 '20 at 20:37
  • I tried this module, but couldn't connect it with button, and csv file doesnt change when I stop playing music. – hibana1801 Feb 11 '20 at 21:09

0 Answers0