当" set_volumemore11"时,如何显示和设置音量?是按下了吗?
class MainPage(Screen):
filenamemore11 = 'synth1.wav'
soundmore11 = ObjectProperty(None, allownone=True)
volumemore11 = NumericProperty(1.0)
def openmore1(self, *args):
self.more11slider = Slider(orientation='horizontal', min=0, max=1, value= self.volumemore11)
self.more11slider.bind(on_value=self.set_volumemore11(self.value))
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()
def set_volumemore11(self, volumemore11):
self.volumemore11 = volumemore11
if self.soundmore11:
self.soundmore11.volumemore11 = volumemore11
到目前为止,我已经尝试了所有我知道的内容,包括value= self.soundmore11.volumemore11
到on_value=self.set_volumemore11(self.value)
,但它仍然无效。任何类型的帮助将不胜感激。
答案 0 :(得分:0)
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()
我忘记回答这个问题,但是,她是一个简单的方法......你也可以在按下vol按钮时通过这样做来改变音量。
def set_volumemore11(self, *args):
self.volumemore11 += 0.2
if self.volumemore11 ==: 1.2
self.volumemore11 = 0.0