Skip to content Skip to sidebar Skip to footer

Kivy Sound Volume. Python

How do I display and set the volume when 'set_volumemore11' is pressed? class MainPage(Screen): filenamemore11 = 'synth1.wav' soundmore11 = ObjectProperty(None, allownone=T

Solution 1:

def openmore1(self, *args):
    self.more11slider = Slider(orientation='horizontal',step=0.1, min=0, max=1, value= self.volumemore11)
    self.add_widget(self.more11slider)

def playmore11(self, *args):
    if self.soundmore11 is None:
        self.soundmore11 = SoundLoader.load(self.filenamemore11)
    if self.soundmore11.status != 'stop':
        self.soundmore11.stop()
    self.soundmore11.loop = False
    self.soundmore11.volumemore11 = self.volumemore11
    self.soundmore11.play()

I forgot to answer this question but, her is an easy way... Also you can change the volume by doing something like this when the vol button is pressed.

def set_volumemore11(self, *args):
    self.volumemore11 += 0.2
    if self.volumemore11 ==: 1.2
        self.volumemore11 = 0.0

Post a Comment for "Kivy Sound Volume. Python"