当前位置: 首页>>代码示例>>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;未经允许,请勿转载。