Http://blog.csdn.net/jj_liuxin/archive/2008/12/21/3574638.aspx
Just take a look at the python 3.0 documentation and find a very pythonic module: sound playback for windows; a buzzword called "silly and naive", which is quite easy.
1> winsound. BEEP2> winsound. playsound ()
Each one has a different usage. Let's look at it one by one.1> winsound. Beep (frequency, d
Python allows you to play music at regular intervals with an alarm clock and python to play music.
You can only play audio in wav format for your reference. The specific content is as follows:
Python code:
Import time import sys soundFile = 'sound.wav 'not_executed = 1 def soundStart (): if sys. platform [: 5] = 'linux ': import OS. popen2 ('aplay-Q' + soundFile) else: import winsound. playSound (soundFile, winsou
A simple log monitoring script with the following functions: 1.windows environment 2. When the log keyword is matched, a sound is emitted, different keywords are matched, and different sounds are played 3. Real-time response possible
Note: It is in the win environment OH
Go directly to the code.
#!/usr/bin/env python# encoding:utf-8 "" "monitorlog.py Usage:MonitorLog.py ... Monitor the log file-f log file-h help info python monitorlog.py-f C:\monitor.log "" "Import sysimport Osimpor T getoptimp
#filename my little alarm clock.Import timeImport SysImport WinSoundA=time.ctime ()Print ("***************** Pro is Now", A, "**********************")Print ("*********************** welcome you to use Shup DIY alarm Clock applet ***********************")Hour1=int (Input ("*****************", enter the hour you want to set the alarm (for example, 10): "))Minutes=int (Input ("**************** Pro, please enter the minutes to set the alarm (e.g. 20):"))i = 3O=3While I:A= list (Time.localtime ()) #获
This article mainly introduces the python calls the machine horn beeps (Beep) The method, the example analyzes the python to invoke the WinSound module the use skill, needs the friend to be possible to refer to under
The example in this article describes the way Python invokes the Beep (Beep) of the machine horn. Share to everyone for your reference. The specific analysis is as follows:
The following Python code can call the machine horn beep (Beep
: if k = '-F ': path = v elif k = '-H': print _ doc _ return 0 if not (path and OS. path. exists (path): print 'invalid path: % s' % path print _ doc _ return 2 # command line tuples cmd = ('tail', '-F ', path) print ''. join (cmd) output = subprocess. popen (cmd, stdout = subprocess. PIPE) keywordMap ={}# load monitoring keyword information with codecs. open (OS. path. join (ABSPATH, MONITERCONF), 'R', 'utf8') as f: lines = f. readlines () for line in lines: line = line. strip () if not line: c
provide this function, but you can enter from the intermediate web site, you can reset the user nameHttp://passport.haodf.com/user/sendpasswordsucc? Type = mobile username = xxxxxxx
3. Reset through emailSimilar to 1, resetting by mobile phone numberA simple EXP written in python# Encoding = utf8Username = 'init'
Class MyHTTPRedirectHandler (urllib2.HTTPRedirectHandler ):Def http_error_302 (self, req, fp, code, msg, httpmsg ):For header in httpmsg. headers:If header. count ('username = ')> 0:G
beep for a while to remind me that I should go to work. This is mainly a new function, how to make the calculator beep.
The Code is as follows (python 2.7 ):
1 #-*-coding: UTF-8-*-2 from tkinter import * # import Tkinter Library 3 import time, datetime, winsound, threading 4 5 root = Tk () 6 lbl = Label (root, text = "hello, world", width = 30, height = 2) 7 8 def tick (): 9 global timer10 timer = threading. timer (1.0, tick, "") 11 currenttime =
article mainly introduces the python calls the machine horn beeps (Beep) method, the example analysis Python calls the WinSound module the use skill, needs the friend to refer to the next
4. VC6.0 Small Problems and tips
Introduction: Introduction to VC6.0 small problems and tips 1. Check if the parentheses in the program are matched move the cursor to the parentheses you want to detect, such as curly braces {}, brackets [], parentheses (), and angle
source file participle 206. Tabnany: Fuzzy indentation detection207. Pyclbr: Python class browsing support 208. Py_compile: Compiling python source files 209. Compileall: Compiling python libraries by byteDis: The disassembler of Python bytecode 211. Pickletools: Serialization Development toolsOther212. Formatter: Universal formatted outputWindows- related213. Msilib: Read and write Windows Installer files 214. MSVCRT: A useful program for MS VC + + Runtime215. WinReg: Windows registry Access 2
beep for a while to remind me that I should go to work. This is mainly a new function, how to make the calculator beep.
The Code is as follows (python 2.7 ):
#-*-Coding: UTF-8-*-from tkinter import * # import the Tkinter library import time, datetime, winsound, threadingroot = Tk () lbl = Label (root, text = "hello, world", width = 30, height = 2) def tick (): global timer = threading. timer (1.0, tick, "") currenttime = time. strftime ('% Y-% m-% d
by many original versions have been corrected.
Compared with the previous alpha versions, we can find that some infrastructure such as bytes, int, and unicode-related parts have gradually stabilized. For itertools, izip (), imap () all the things that replace builtin's zip, map, and other language features have been completed. It can be said that the core progress is quite good. It is estimated that the beta version is more about reorganizing the organization form of the database, fixing bugs,
: Runing End methods Function obj=SOUNDCARDDAC (FS) Obj.m_fs=FS; Obj.m_ao= Analogoutput ('WinSound'); AddChannel (Obj.m_ao,1); Set(Obj.m_ao,'samplerate', OBJ.M_FS); Obj.m_state=1; fprintf (1,'info:create Soundcarddac object, fs=%d.\n', FS); End Function tx (obj, signal) sample_th1= Obj.m_fs *0.4; %ensure that the sound card has at least 0.4s or so length of data sample_th2= Obj.m_fs *0.6; %usually the sound card buffer data is not too long signal= Res
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.