]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxWave.py
Updated the description of wx.PopupTransientWindow
[wxWidgets.git] / wxPython / demo / wxWave.py
1 # 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5
6 import wx
7
8 from Main import opj
9
10 #----------------------------------------------------------------------
11
12 class TestPanel(wx.Panel):
13 def __init__(self, parent):
14 wx.Panel.__init__(self, parent, -1)
15
16 b = wx.Button(self, -1, "Play Sound 1", (25, 25))
17 self.Bind(wx.EVT_BUTTON, self.OnButton1, b)
18
19 b = wx.Button(self, -1, "Play Sound 2", (25, 65))
20 self.Bind(wx.EVT_BUTTON, self.OnButton2, b)
21
22
23 def OnButton1(self, evt):
24 try:
25 wave = wx.Wave(opj('data/anykey.wav'))
26 wave.Play()
27 except NotImplementedError, v:
28 wx.MessageBox(str(v), "Exception Message")
29
30
31 def OnButton2(self, evt):
32 try:
33 wave = wx.Wave(opj('data/plan.wav'))
34 wave.Play()
35 except NotImplementedError, v:
36 wx.MessageBox(str(v), "Exception Message")
37
38 #----------------------------------------------------------------------
39
40 def runTest(frame, nb, log):
41 win = TestPanel(nb)
42 return win
43
44 #----------------------------------------------------------------------
45
46
47 overview = """\
48 This class represents a short wave file, in Windows WAV format, that can
49 be stored in memory and played. Currently this class is implemented on Windows
50 and GTK (Linux) only.
51
52 This demo offers two examples, both driven by buttons, but obviously the event
53 that drives the playing of the sound can come from anywhere.
54
55 """
56
57
58 if __name__ == '__main__':
59 import sys,os
60 import run
61 run.main(['', os.path.basename(sys.argv[0])])