]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/wxWave.py
reSWIGged
[wxWidgets.git] / wxPython / demo / wxWave.py
... / ...
CommitLineData
1# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4#
5
6import wx
7
8from Main import opj
9
10#----------------------------------------------------------------------
11
12class 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
40def runTest(frame, nb, log):
41 win = TestPanel(nb)
42 return win
43
44#----------------------------------------------------------------------
45
46
47overview = """\
48This class represents a short wave file, in Windows WAV format, that can
49be stored in memory and played. Currently this class is implemented on Windows
50and GTK (Linux) only.
51
52This demo offers two examples, both driven by buttons, but obviously the event
53that drives the playing of the sound can come from anywhere.
54
55"""
56
57
58if __name__ == '__main__':
59 import sys,os
60 import run
61 run.main(['', os.path.basename(sys.argv[0])])