]>
Commit | Line | Data |
---|---|---|
8fa876ca RD |
1 | |
2 | import wx | |
493f1553 | 3 | |
6c5ae2d2 | 4 | from Main import opj |
493f1553 RD |
5 | |
6 | #---------------------------------------------------------------------- | |
7 | ||
8fa876ca | 8 | class TestPanel(wx.Panel): |
493f1553 | 9 | def __init__(self, parent): |
8fa876ca | 10 | wx.Panel.__init__(self, parent, -1) |
493f1553 | 11 | |
8fa876ca RD |
12 | b = wx.Button(self, -1, "Play Sound 1", (25, 25)) |
13 | self.Bind(wx.EVT_BUTTON, self.OnButton1, b) | |
493f1553 | 14 | |
8fa876ca RD |
15 | b = wx.Button(self, -1, "Play Sound 2", (25, 65)) |
16 | self.Bind(wx.EVT_BUTTON, self.OnButton2, b) | |
493f1553 | 17 | |
e5dd90b1 RD |
18 | |
19 | def OnButton1(self, evt): | |
20 | try: | |
78862f24 RD |
21 | sound = wx.Sound(opj('data/anykey.wav')) |
22 | sound.Play() | |
e5dd90b1 | 23 | except NotImplementedError, v: |
8fa876ca | 24 | wx.MessageBox(str(v), "Exception Message") |
e5dd90b1 RD |
25 | |
26 | ||
27 | def OnButton2(self, evt): | |
493f1553 | 28 | try: |
78862f24 RD |
29 | sound = wx.Sound(opj('data/plan.wav')) |
30 | sound.Play() | |
493f1553 | 31 | except NotImplementedError, v: |
8fa876ca | 32 | wx.MessageBox(str(v), "Exception Message") |
493f1553 RD |
33 | |
34 | #---------------------------------------------------------------------- | |
35 | ||
36 | def runTest(frame, nb, log): | |
37 | win = TestPanel(nb) | |
38 | return win | |
39 | ||
40 | #---------------------------------------------------------------------- | |
41 | ||
42 | ||
78862f24 RD |
43 | overview = """<html><body> |
44 | <h2>Sound</h2> | |
8fa876ca RD |
45 | This class represents a short wave file, in Windows WAV format, that can |
46 | be stored in memory and played. Currently this class is implemented on Windows | |
47 | and GTK (Linux) only. | |
78862f24 | 48 | <p> |
8fa876ca RD |
49 | This demo offers two examples, both driven by buttons, but obviously the event |
50 | that drives the playing of the sound can come from anywhere. | |
1fded56b | 51 | |
78862f24 | 52 | </body></html> |
8fa876ca | 53 | """ |
1fded56b RD |
54 | |
55 | ||
56 | if __name__ == '__main__': | |
57 | import sys,os | |
58 | import run | |
59 | run.main(['', os.path.basename(sys.argv[0])]) |