本文整理匯總了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)