I'm trying to use .get()
to access entry from my Scale
but the volume doesn't change when I move slider. I'm using pygame
mixer too btw.
Relevant code;
def change_vol():
sounds.music.set_volume(vol.get())
#########################################
def play_music():
load_music()
sounds.music.play()
pass
##########################
def load_music():
sounds.music.load("fakeplastic.wav")
vol = Scale(
sound_box,
from_ = 0,
to = 1,
orient = HORIZONTAL ,
resolution = .1,
)
vol.grid(row = 3, column = 1)
If you'd like me to post any other snippets please ask, thanks.
It looks like you forgot to assign the
Scale
'scommand
option tochange_vol
so that the function is called each time you adjust the scale: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:I did
_=None
to make it clear that you are not using the argument inside the function.