Python winsound.SND_ASYNC Examples
The following are 27
code examples of winsound.SND_ASYNC().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
winsound
, or try the search function
.
Example #1
Source File: rmEngine.py From vnpy_crypto with MIT License | 6 votes |
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) # ----------------------------------------------------------------------
Example #2
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
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]
Example #3
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 6 votes |
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 )
Example #4
Source File: rmEngine.py From chanlun with MIT License | 6 votes |
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) #----------------------------------------------------------------------
Example #5
Source File: ksp_plugin.py From SublimeKSP with GNU General Public License v3.0 | 6 votes |
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])
Example #6
Source File: rmEngine.py From InplusTrader_Linux with MIT License | 5 votes |
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) #----------------------------------------------------------------------
Example #7
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, call_id='', string=""): panel = eg.ConfigPanel() labelText = wx.StaticText(panel, -1, self.plugin.text.call_id_label) w,h=labelText.GetSize() labelDtmf = wx.StaticText(panel, -1, self.text.dtmfLabel) textControl = wx.TextCtrl(panel, -1, call_id) textControl.SetMinSize((w,-1)) textControl2 = wx.TextCtrl(panel, -1, string) textControl2.SetMinSize((w,-1)) textControl2.SetToolTip(wx.ToolTip(self.text.toolTip)) panel.sizer.Add(labelText,0,wx.TOP,10) panel.sizer.Add(textControl,0,wx.TOP,3) panel.sizer.Add(labelDtmf,0,wx.TOP,10) panel.sizer.Add(textControl2,0,wx.TOP,3) def onStringChange(evt): val = textControl2.GetValue() cur = textControl2.GetInsertionPoint() lng = len(val) tmp = [] for char in val: if char in ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","*","#"]: tmp.append(char) val = "".join(tmp) textControl2.ChangeValue(val) if len(val) < lng: PlaySound('SystemExclamation',SND_ASYNC) cur += -1 textControl2.SetInsertionPoint(cur) evt.Skip() textControl2.Bind(wx.EVT_TEXT,onStringChange) while panel.Affirmed(): panel.SetResult(textControl.GetValue(),textControl2.GetValue())
Example #8
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def UpdateMenu(self, ix=0): self.items = GetItemList(self.menu, self.hWnd) if len(self.items)==0: PlaySound('SystemExclamation', SND_ASYNC) self.menu,ix = self.oldMenu.pop() self.items = GetItemList(self.menu, self.hWnd) self.choices = [item[0] for item in self.items] self.menuGridCtrl.Set(self.items) self.DrawMenu(ix)
Example #9
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnData(self, dummyX, dummyY, dragResult): if self.GetData() and self.customData.GetDataSize() > 0: txt = self.customData.GetData() ix, evtList = self.object.GetEvtList() flag = True for lst in evtList: if txt in lst: flag = False break if flag: self.object.InsertImageStringItem(len(evtList[ix]), txt, 0) self.object.UpdateEvtList(ix, txt) else: PlaySound('SystemExclamation', SND_ASYNC)
Example #10
Source File: space_arena.py From Projects with GNU General Public License v3.0 | 5 votes |
def play_sound(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: play_sound(sound_file, time), t=int(time * 1000))
Example #11
Source File: spgl.py From Projects with GNU General Public License v3.0 | 5 votes |
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))
Example #12
Source File: strategy_model.py From equant with GNU General Public License v2.0 | 5 votes |
def setAlert(self, Info, bKeep, level): #出声音 if bKeep: if level in self._audioDict: audioName = self._audioDict[level] else: audioName = 'SystemQuestion' winsound.PlaySound(audioName, winsound.SND_ASYNC) #弹窗 createAlarmWin(Info, self._strategy.getStrategyId(), self._strategy.getStrategyName());
Example #13
Source File: test_winsound.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_errors(self): self.assertRaises(TypeError, winsound.PlaySound) self.assertRaises(TypeError, winsound.PlaySound, "bad", "bad") self.assertRaises( RuntimeError, winsound.PlaySound, "none", winsound.SND_ASYNC | winsound.SND_MEMORY )
Example #14
Source File: rmEngine.py From py3_demo_on_vnpy_ctp with MIT License | 5 votes |
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) #----------------------------------------------------------------------
Example #15
Source File: spgl.py From SPGL with GNU General Public License v3.0 | 5 votes |
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))
Example #16
Source File: spgl.py From SPGL with GNU General Public License v3.0 | 5 votes |
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))
Example #17
Source File: gstreamer.py From pychess with GNU General Public License v3.0 | 5 votes |
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:]))
Example #18
Source File: _test_playsound.py From dragonfly with GNU Lesser General Public License v3.0 | 5 votes |
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)
Example #19
Source File: action_playsound.py From dragonfly with GNU Lesser General Public License v3.0 | 5 votes |
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)
Example #20
Source File: audiofeedback.py From edr with Apache License 2.0 | 5 votes |
def notify(self): winsound.PlaySound(self.snd_notify, winsound.SND_ASYNC)
Example #21
Source File: audiofeedback.py From edr with Apache License 2.0 | 5 votes |
def warn(self): winsound.PlaySound(self.snd_warn, winsound.SND_ASYNC)
Example #22
Source File: uiMultiRpcMonitor.py From vnpy_crypto with MIT License | 5 votes |
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) # ----------------------------------------------------------------------
Example #23
Source File: uiMultiRpcMonitor.py From vnpy_crypto with MIT License | 5 votes |
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) # ----------------------------------------------------------------------
Example #24
Source File: uiBasicWidget.py From vnpy_crypto with MIT License | 5 votes |
def play_trade(self, event): """播放交易声音""" # 1.获取事件的Trade数据 trade = event.dict_['data'] winsound.PlaySound('match.wav', winsound.SND_ASYNC) ########################################################################
Example #25
Source File: uiBasicWidget.py From vnpy_crypto with MIT License | 5 votes |
def play_trade(self, event): """播放交易声音""" # 1.获取事件的Trade数据 trade = event.dict_['data'] winsound.PlaySound('warn.wav', winsound.SND_ASYNC) ########################################################################
Example #26
Source File: strategy_model.py From equant with GNU General Public License v2.0 | 4 votes |
def sendSignalEvent(self, signalName, userNo, contNo, direct, offset, price, share, curBar): if not curBar: return data = [{ 'KLineIndex': curBar['KLineIndex'], 'ContractNo': contNo, 'Direct': direct, 'Offset': offset, 'Price': price, 'Qty': share, }] # eventCode = EV_ST2EG_UPDATE_KLINESIGNAL if self._strategy.isRealTimeStatus() else EV_ST2EG_NOTICE_KLINESIGNAL signalNoticeEvent = Event({ "EventCode": eventCode, "StrategyId": self._strategy.getStrategyId(), "Data": { 'SeriesName': signalName, 'Count': len(data), 'Data': data, } }) self._strategy.sendEvent2Engine(signalNoticeEvent) if not userNo: userNo = self._cfgModel.getUserNo() #处理报警 if self._strategy.isRealTimeStatus() and self._cfgModel.getAlarm(): #if self._cfgModel.getAlarm(): #出声音 audioName = self._audioDict['Signal'] winsound.PlaySound(audioName, winsound.SND_ASYNC) #弹窗,合约,方向,手数,价格 alarmStr = '策略: ' + str(self._strategy.getStrategyId()) + '\n' +\ '账户: ' + userNo + '\n' +\ '合约: ' + contNo + '\n' +\ '方向: ' + self._bsMap[direct] + self._ocMap[offset] + '\n' +\ '数量: ' + str(share) + '\n' +\ '价格: ' + str(price) + '\n' +\ '时间: ' + str(curBar['DateTimeStamp']) + '\n' #允许弹窗 if self._cfgModel.getPop(): createAlarmWin(alarmStr, self._strategy.getStrategyId(), self._strategy.getStrategyName())
Example #27
Source File: wsr_module_loader_plus.py From dragonfly with GNU Lesser General Public License v3.0 | 4 votes |
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.