def play(self, event): from pygame import mixer if not mixer.get_init(): mixer.init() if mixer.get_busy() and self.sound: self.sound.stop() return volume_attr = self.aguidata.get('volume') if volume_attr: volume = getattr(self.window.object, volume_attr) else: volume = 1 try: sound = get_sound(self.get_control_value(), volume=volume) sound.play() self.sound = sound except: self.sound = None self.play_button_down = True self.looping = False wx.CallLater(0.1, self.test_button) event.Skip()
def play(self, event): from pygame import mixer if not mixer.get_init(): mixer.init() if mixer.get_busy() and self.sound: self.sound.stop() return volume_attr = self.aguidata.get("volume") if volume_attr: volume = getattr(self.window.object, volume_attr) else: volume = 1 try: sound = get_sound(self.get_control_value(), volume=volume) sound.play() self.sound = sound except: self.sound = None self.play_button_down = True self.looping = False wx.CallLater(0.1, self.test_button) event.Skip()
def on_first_display(self, register_type="single"): "Set up sounds and register for mouse events" self.hover_sound_object = get_sound(self.hover_sound) self.click_sound_object = get_sound(self.click_sound) self.base_look = self.owner.tint self.owner.mouse_register(register_type)
def setup(self): "setup(): Set up the sound. This is for ease of derivation." scene = PigDirector.scene #@UndefinedVariable self.sound_object = get_sound( self.sound, volume=self.volume)
def setup(self): "setup(): Set up the sound. This is for ease of derivation." scene = PigDirector.scene #@UndefinedVariable self.sound_object = get_sound(self.sound, volume=self.volume)
def setup_spawner(self): "Setup for the spawner. Subclasses should call this." if self.sound: self.sound_object = get_sound( self.sound, volume=self.volume) if self.spawned_objects is None: self.spawned_objects = weakref.WeakValueDictionary()
def setup_spawner(self): "Setup for the spawner. Subclasses should call this." if self.sound: self.sound_object = get_sound(self.sound, volume=self.volume) if self.spawned_objects is None: self.spawned_objects = weakref.WeakValueDictionary()