]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | from wxPython.wx import * | |
3 | ||
4 | #---------------------------------------------------------------------- | |
5 | ||
6 | class TestPanel(wxPanel): | |
7 | def __init__(self, parent): | |
8 | wxPanel.__init__(self, parent, -1) | |
9 | ||
10 | b = wxButton(self, -1, "Play Sound", (25, 25)) | |
11 | EVT_BUTTON(self, b.GetId(), self.OnButton) | |
12 | ||
13 | ||
14 | def OnButton(self, evt): | |
15 | try: | |
16 | import time | |
17 | if int(time.time()) % 2 == 1: | |
18 | wave = wxWave('data/anykey.wav') | |
19 | else: | |
20 | wave = wxWave('data/plan.wav') | |
21 | wave.Play() | |
22 | except NotImplementedError, v: | |
23 | wxMessageBox(str(v), "Exception Message") | |
24 | ||
25 | ||
26 | #---------------------------------------------------------------------- | |
27 | ||
28 | def runTest(frame, nb, log): | |
29 | win = TestPanel(nb) | |
30 | return win | |
31 | ||
32 | #---------------------------------------------------------------------- | |
33 | ||
34 | ||
35 | overview = """\ | |
36 | """ |