本文整理汇总了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)
# ----------------------------------------------------------------------
示例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)
#----------------------------------------------------------------------
示例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
)
示例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]
示例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])
示例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)
########################################################################
示例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)
# ----------------------------------------------------------------------
示例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)
# ----------------------------------------------------------------------
示例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.
示例10: warn
# 需要导入模块: import winsound [as 别名]
# 或者: from winsound import SND_ASYNC [as 别名]
def warn(self):
winsound.PlaySound(self.snd_warn, winsound.SND_ASYNC)
示例11: notify
# 需要导入模块: import winsound [as 别名]
# 或者: from winsound import SND_ASYNC [as 别名]
def notify(self):
winsound.PlaySound(self.snd_notify, winsound.SND_ASYNC)
示例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)
示例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:]))
示例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))
示例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)
#----------------------------------------------------------------------