当前位置: 首页>>代码示例>>Python>>正文


Python mixer.quit方法代码示例

本文整理汇总了Python中pygame.mixer.quit方法的典型用法代码示例。如果您正苦于以下问题:Python mixer.quit方法的具体用法?Python mixer.quit怎么用?Python mixer.quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pygame.mixer的用法示例。


在下文中一共展示了mixer.quit方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_init__returns_exact_values_used_for_init

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def test_get_init__returns_exact_values_used_for_init(self):
        # fix in 1.9 - I think it's a SDL_mixer bug.

        # TODO: When this bug is fixed, testing through every combination
        #       will be too slow so adjust as necessary, at the moment it
        #       breaks the loop after first failure

        for init_conf in CONFIGS:
            frequency, size, channels
            if (frequency, size) == (22050, 16):
                continue
            mixer.init(frequency, size, channels)

            mixer_conf = mixer.get_init()

            self.assertEqual(init_conf, mixer_conf)
            mixer.quit() 
开发者ID:wistbean,项目名称:fxxkpython,代码行数:19,代码来源:mixer_test.py

示例2: _quit_pygame

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def _quit_pygame(self):
        logging.info("INFO: unloading pygame")
        mixer.quit() 
开发者ID:krahsdevil,项目名称:Retropie-CRT-Edition,代码行数:5,代码来源:bgm.py

示例3: cleanup

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def cleanup(self):
        os.system('clear')
        pygame.quit()
        self.__clean()
        sys.exit(1)

    # clean system 
开发者ID:krahsdevil,项目名称:Retropie-CRT-Edition,代码行数:9,代码来源:bgm.py

示例4: speak_pygame

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def speak_pygame(self):
        mixer.init()
        mixer.pause()
        mixer.music.load(self.speak_result)
        mixer.music.play()
        self.hibernate()
        mixer.music.stop()
        mixer.unpause()
        mixer.quit() 
开发者ID:SlapBot,项目名称:stephanie-va,代码行数:11,代码来源:speaker.py

示例5: send_email

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def send_email(self, msg: MIMEText):
        msg['From'] = 'pi@localhost'
        msg['To'] = 'remote@host.com'
        try:
            s = SMTP('localhost')
            s.send_message(msg)
            s.quit()
        except:
            print('E-mail send failed.') 
开发者ID:bggardner,项目名称:simplisafe-rf,代码行数:11,代码来源:basestation.py

示例6: stop_siren

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def stop_siren(self):
        if mixer and mixer.get_init():
            mixer.music.stop()
            mixer.quit() 
开发者ID:bggardner,项目名称:simplisafe-rf,代码行数:6,代码来源:basestation.py

示例7: cleanup

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def cleanup():
    """Cleanup before exiting"""

    if not window:
        return

    w_str = get_window_contents()
    curses.curs_set(1)
    curses.endwin()

    print(w_str.rstrip())
    print

    mixer.quit() 
开发者ID:drensin,项目名称:Remixatron,代码行数:16,代码来源:infinite_jukebox.py

示例8: _reset_audio_widget

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def _reset_audio_widget(self):
        """Reset the widget. Stop all playing samples."""
        self._first_call = True
        self._paused = False
        if mixer.get_init():
            if mixer.music.get_busy():
                mixer.music.stop()
                self._timer.stop()
            mixer.quit()
        self._audio_progress.reset()
        self._enable_buttons(False, False, False) 
开发者ID:AresValley,项目名称:Artemis,代码行数:13,代码来源:audio_player.py

示例9: tearDown

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def tearDown(self):
        mixer.quit()
        mixer.pre_init(0, 0, 0, 0) 
开发者ID:wistbean,项目名称:fxxkpython,代码行数:5,代码来源:mixer_test.py

示例10: test_quit

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def test_quit(self):
        """ get_num_channels() Should throw pygame.error if uninitialized
        after mixer.quit() """
        mixer.init()
        mixer.quit()
        self.assertRaises(pygame.error, mixer.get_num_channels) 
开发者ID:wistbean,项目名称:fxxkpython,代码行数:8,代码来源:mixer_test.py

示例11: tearDownClass

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def tearDownClass(cls):
        mixer.quit() 
开发者ID:wistbean,项目名称:fxxkpython,代码行数:4,代码来源:mixer_test.py

示例12: setUp

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def setUp(cls):
        # This makes sure the mixer is always initialized before each test (in
        # case a test calls pygame.mixer.quit()).
        if mixer.get_init() is None:
            mixer.init() 
开发者ID:wistbean,项目名称:fxxkpython,代码行数:7,代码来源:mixer_test.py

示例13: test_sound__before_init

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def test_sound__before_init(self):
        """Ensure exception raised for Sound() creation with non-init mixer."""
        mixer.quit()
        filename = example_path(os.path.join('data', 'house_lo.wav'))

        with self.assertRaisesRegex(pygame.error, 'mixer not initialized'):
            mixer.Sound(file=filename) 
开发者ID:wistbean,项目名称:fxxkpython,代码行数:9,代码来源:mixer_test.py

示例14: test_channel__before_init

# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def test_channel__before_init(self):
        """Ensure exception for Channel() creation with non-init mixer."""
        mixer.quit()

        with self.assertRaisesRegex(pygame.error, 'mixer not initialized'):
            mixer.Channel(0) 
开发者ID:wistbean,项目名称:fxxkpython,代码行数:8,代码来源:mixer_test.py


注:本文中的pygame.mixer.quit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。