some update regarding beep()

This commit is contained in:
Miroslav Stampar 2010-10-26 08:32:58 +00:00
parent b9ff91b6e9
commit 8803096343

View File

@ -1505,22 +1505,29 @@ def beep():
"""
if sys.platform == 'linux2':
for dev in ('/dev/audio', '/dev/dsp'):
if os.path.exists(dev):
try:
audio = file(dev, 'wb')
for i in xrange(250):
audio.write(chr(32) * 4)
audio.write(chr(0) * 4)
audio.close()
return
except:
pass
try:
if os.path.exists('/dev/audio'):
audio = file('/dev/audio', 'wb')
for i in xrange(250):
audio.write(chr(32) * 4)
audio.write(chr(0) * 4)
audio.close()
else:
import curses
curses.initscr()
curses.beep()
curses.endwin()
import curses
curses.initscr()
curses.beep()
curses.flash()
curses.endwin()
return
except:
dataToStdout('\a', True)
else:
dataToStdout('\a', True)