]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Wave.py
   6 #---------------------------------------------------------------------- 
   8 class TestPanel(wx
.Panel
): 
   9     def __init__(self
, parent
): 
  10         wx
.Panel
.__init
__(self
, parent
, -1) 
  12         b 
= wx
.Button(self
, -1, "Play Sound 1", (25, 25)) 
  13         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton1
, b
) 
  15         b 
= wx
.Button(self
, -1, "Play Sound 2", (25, 65)) 
  16         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton2
, b
) 
  19     def OnButton1(self
, evt
): 
  21             wave 
= wx
.Wave(opj('data/anykey.wav')) 
  23         except NotImplementedError, v
: 
  24             wx
.MessageBox(str(v
), "Exception Message") 
  27     def OnButton2(self
, evt
): 
  29             wave 
= wx
.Wave(opj('data/plan.wav')) 
  31         except NotImplementedError, v
: 
  32             wx
.MessageBox(str(v
), "Exception Message") 
  34 #---------------------------------------------------------------------- 
  36 def runTest(frame
, nb
, log
): 
  40 #---------------------------------------------------------------------- 
  44 This class represents a short wave file, in Windows WAV format, that can  
  45 be stored in memory and played. Currently this class is implemented on Windows  
  48 This demo offers two examples, both driven by buttons, but obviously the event 
  49 that drives the playing of the sound can come from anywhere. 
  54 if __name__ 
== '__main__': 
  57     run
.main(['', os
.path
.basename(sys
.argv
[0])])