Skip to content
Advertisement

How do I change the volume in realtime for my music player (pygame)

I am trying to change the volume of my music in realtime for my music player.

My code:

JavaScript

And here are the action events:

JavaScript

But I don’t know how to change the volume while the music is playing, it only changes the volume after I restart the song.

I tried:

JavaScript

But that didn’t work it just game me an error.

Advertisement

Answer

If you don’t use OOP(and I dont think you do based on what you provided), this should be the solution:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement