本文整理汇总了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()
示例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()
示例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
示例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()
示例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.')
示例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()
示例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()
示例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)
示例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)
示例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)
示例11: tearDownClass
# 需要导入模块: from pygame import mixer [as 别名]
# 或者: from pygame.mixer import quit [as 别名]
def tearDownClass(cls):
mixer.quit()
示例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()
示例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)
示例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)