Creating a volume slider in tkinter
It looks like you forgot to assign the Scale
's command
option to change_vol
so that the function is called each time you adjust the scale:
vol = Scale( sound_box, from_ = 0, to = 1, orient = HORIZONTAL , resolution = .1, #################### command=change_vol ####################)
You will also need to redefine change_vol
to accept the event object that will be sent to it every time you move the scale:
def change_vol(_=None): sounds.music.set_volume(vol.get())
I did _=None
to make it clear that you are not using the argument inside the function.