當前位置: 首頁>>代碼示例>>Python>>正文


Python winsound.SND_ASYNC屬性代碼示例

本文整理匯總了Python中winsound.SND_ASYNC屬性的典型用法代碼示例。如果您正苦於以下問題:Python winsound.SND_ASYNC屬性的具體用法?Python winsound.SND_ASYNC怎麽用?Python winsound.SND_ASYNC使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在winsound的用法示例。


在下文中一共展示了winsound.SND_ASYNC屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: writeRiskLog

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def writeRiskLog(self, content):
        """快速發出日誌事件"""
        # 發出報警提示音

        if platform.uname() == 'Windows':
            import winsound
            winsound.PlaySound("SystemHand", winsound.SND_ASYNC) 
        
        # 發出日誌事件
        log = VtLogData()
        log.logContent = content
        log.gatewayName = self.name
        event = Event(type_=EVENT_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)      
    
    # ---------------------------------------------------------------------- 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:19,代碼來源:rmEngine.py

示例2: writeRiskLog

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def writeRiskLog(self, content):
        """快速發出日誌事件"""
        # 發出報警提示音

        if platform.uname() == 'Windows':
            import winsound
            winsound.PlaySound("SystemHand", winsound.SND_ASYNC) 
        
        # 發出日誌事件
        log = VtLogData()
        log.logContent = content
        log.gatewayName = self.name
        event = Event(type_=EVENT_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)      
    
    #---------------------------------------------------------------------- 
開發者ID:sunshinelover,項目名稱:chanlun,代碼行數:19,代碼來源:rmEngine.py

示例3: test_stopasync

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def test_stopasync(self):
        if _have_soundcard():
            winsound.PlaySound(
                'SystemQuestion',
                winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP
            )
            time.sleep(0.5)
            try:
                winsound.PlaySound(
                    'SystemQuestion',
                    winsound.SND_ALIAS | winsound.SND_NOSTOP
                )
            except RuntimeError:
                pass
            else: # the first sound might already be finished
                pass
            winsound.PlaySound(None, winsound.SND_PURGE)
        else:
            self.assertRaises(
                RuntimeError,
                winsound.PlaySound,
                None, winsound.SND_PURGE
            ) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:25,代碼來源:test_winsound.py

示例4: SchedulGhost_EggFunction

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def SchedulGhost_EggFunction(self, key):
        args = self.eggTimers[key]
        now = mktime(localtime())
        delta = Ticks2Delta(key, now)
        self.updateLogFile(self.text.eggElaps % (args[1], args[2], delta))
        eg.TriggerEvent(args[2], prefix = args[1])
        sound = None
        if len(args[3]) > 0:
            sound = wx.Sound(args[3])
            if os.path.isfile(args[3]) and sound.IsOk():
                sound.Play(wx.SOUND_ASYNC)
            else:
                self.PrintError(self.text.soundProblem % args[3])
                PlaySound('SystemExclamation', SND_ASYNC)
        if len(args[4]) > 0:
            wx.CallAfter(
                PopupText,
                None,
                self,
                args[4:],
                None,
                sound
            )
        del self.eggTimers[key] 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:26,代碼來源:__init__.py

示例5: play

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def play(self, **kwargs):
        sound_path = os.path.join(self.dir, '{}.wav'.format(kwargs['command']))

        if sublime.platform() == "osx":
            if os.path.isfile(sound_path):
                call(["afplay", "-v", str(1), sound_path])

        if sublime.platform() == "windows":
            if os.path.isfile(sound_path):
                winsound.PlaySound(sound_path, winsound.SND_FILENAME | winsound.SND_ASYNC | winsound.SND_NODEFAULT)

        if sublime.platform() == "linux":
            if os.path.isfile(sound_path):
                call(["aplay", sound_path]) 
開發者ID:nojanath,項目名稱:SublimeKSP,代碼行數:16,代碼來源:ksp_plugin.py

示例6: play_trade

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def play_trade(self, event):
        """播放交易聲音"""

        # 1.獲取事件的Trade數據
        trade = event.dict_['data']
        winsound.PlaySound('warn.wav', winsound.SND_ASYNC)

######################################################################## 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:10,代碼來源:uiBasicWidget.py

示例7: updateWarning

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def updateWarning(self, event):
        """更新相關Warning """
        log = event.dict_['data']
        content = '\t'.join([log.logTime, log.logContent])
        self.logMonitor.append(content)
        winsound.PlaySound('err.wav', winsound.SND_ASYNC)

    # ---------------------------------------------------------------------- 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:10,代碼來源:uiMultiRpcMonitor.py

示例8: updateError

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def updateError(self, event):
        """更新相關Error """
        log = event.dict_['data']
        content = '\t'.join([log.errorTime, log.errorID,log.errorMsg,log.additionalInfo])
        self.logMonitor.append(content)
        winsound.PlaySound('err.wav', winsound.SND_ASYNC)

    # ---------------------------------------------------------------------- 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:10,代碼來源:uiMultiRpcMonitor.py

示例9: play_sound

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def play_sound(sound, async_=True):
    if sound in sound_mappings: sound = sound_mappings[sound]
    winsound.PlaySound(sound, winsound.SND_FILENAME | (winsound.SND_ASYNC if async_ else 0))


# --------------------------------------------------------------------------
# Sleep/wake grammar. 
開發者ID:dictation-toolbox,項目名稱:dragonfly,代碼行數:9,代碼來源:wsr_module_loader_plus.py

示例10: warn

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def warn(self):
            winsound.PlaySound(self.snd_warn, winsound.SND_ASYNC) 
開發者ID:lekeno,項目名稱:edr,代碼行數:4,代碼來源:audiofeedback.py

示例11: notify

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def notify(self):
            winsound.PlaySound(self.snd_notify, winsound.SND_ASYNC) 
開發者ID:lekeno,項目名稱:edr,代碼行數:4,代碼來源:audiofeedback.py

示例12: __init__

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def __init__(self, name=None, file=None):
        ActionBase.__init__(self)
        if name is not None:
            self._name = name
            self._flags = winsound.SND_ASYNC | winsound.SND_ALIAS
        elif file is not None:
            self._name = file
            self._flags = winsound.SND_ASYNC | winsound.SND_FILENAME

        self._str = str(self._name) 
開發者ID:t4ngo,項目名稱:dragonfly,代碼行數:12,代碼來源:action_playsound.py

示例13: play

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def play(self, uri):
            try:
                winsound.PlaySound(None, 0)
                winsound.PlaySound(
                    url2pathname(uri[5:]), winsound.SND_FILENAME | winsound.SND_ASYNC)
            except RuntimeError:
                log.error("ERROR: RuntimeError while playing %s." %
                          url2pathname(uri[5:])) 
開發者ID:pychess,項目名稱:pychess,代碼行數:10,代碼來源:gstreamer.py

示例14: play_sound

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def play_sound(self, sound_file, time = 0):
        # Windows
        if platform.system() == 'Windows':
            winsound.PlaySound(sound_file, winsound.SND_ASYNC)
        # Linux
        elif platform.system() == "Linux":
            os.system("aplay -q {}&".format(sound_file))
        # Mac
        else:
            os.system("afplay {}&".format(sound_file))

        if time > 0:
	        turtle.ontimer(lambda: self.play_sound(sound_file, time), t=int(time * 1000)) 
開發者ID:wynand1004,項目名稱:SPGL,代碼行數:15,代碼來源:spgl.py

示例15: writeRiskLog

# 需要導入模塊: import winsound [as 別名]
# 或者: from winsound import SND_ASYNC [as 別名]
def writeRiskLog(self, content):
        """快速發出日誌事件"""
        # 發出報警提示音

        if platform.uname() == 'Windows':
            import winsound
            winsound.PlaySound("SystemHand", winsound.SND_ASYNC) 
        
        # 發出日誌事件

        event = Event(type_=EVENT_LOG)
        event.dict_['log'] = content
        self.eventEngine.put(event)      
    
    #---------------------------------------------------------------------- 
開發者ID:vvipi,項目名稱:py3_demo_on_vnpy_ctp,代碼行數:17,代碼來源:rmEngine.py


注:本文中的winsound.SND_ASYNC屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。