2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
import wx
|
2001-05-18 17:59:59 -04:00
|
|
|
|
2002-01-23 20:24:39 -05:00
|
|
|
from Main import opj
|
2001-05-18 17:59:59 -04:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class TestPanel(wx.Panel):
|
2001-05-18 17:59:59 -04:00
|
|
|
def __init__(self, parent):
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
2001-05-18 17:59:59 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
b = wx.Button(self, -1, "Play Sound 1", (25, 25))
|
|
|
|
self.Bind(wx.EVT_BUTTON, self.OnButton1, b)
|
2001-05-18 17:59:59 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
b = wx.Button(self, -1, "Play Sound 2", (25, 65))
|
|
|
|
self.Bind(wx.EVT_BUTTON, self.OnButton2, b)
|
2001-05-18 17:59:59 -04:00
|
|
|
|
2002-03-13 17:26:55 -05:00
|
|
|
|
|
|
|
def OnButton1(self, evt):
|
|
|
|
try:
|
2004-02-02 22:55:05 -05:00
|
|
|
sound = wx.Sound(opj('data/anykey.wav'))
|
|
|
|
sound.Play()
|
2002-03-13 17:26:55 -05:00
|
|
|
except NotImplementedError, v:
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.MessageBox(str(v), "Exception Message")
|
2002-03-13 17:26:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
def OnButton2(self, evt):
|
2001-05-18 17:59:59 -04:00
|
|
|
try:
|
2004-02-02 22:55:05 -05:00
|
|
|
sound = wx.Sound(opj('data/plan.wav'))
|
|
|
|
sound.Play()
|
2001-05-18 17:59:59 -04:00
|
|
|
except NotImplementedError, v:
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.MessageBox(str(v), "Exception Message")
|
2001-05-18 17:59:59 -04:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestPanel(nb)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2004-02-02 22:55:05 -05:00
|
|
|
overview = """<html><body>
|
|
|
|
<h2>Sound</h2>
|
2003-12-08 20:23:28 -05:00
|
|
|
This class represents a short wave file, in Windows WAV format, that can
|
|
|
|
be stored in memory and played. Currently this class is implemented on Windows
|
|
|
|
and GTK (Linux) only.
|
2004-02-02 22:55:05 -05:00
|
|
|
<p>
|
2003-12-08 20:23:28 -05:00
|
|
|
This demo offers two examples, both driven by buttons, but obviously the event
|
|
|
|
that drives the playing of the sound can come from anywhere.
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2004-02-02 22:55:05 -05:00
|
|
|
</body></html>
|
2003-12-08 20:23:28 -05:00
|
|
|
"""
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-04 19:06:33 -05:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|