當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。