X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1fded56b375bf7a4687af1cdb182899614c1b2a8..61940a7061d0b5d5122b1e1e939cfa2d72596999:/wxPython/demo/wxWave.py?ds=inline diff --git a/wxPython/demo/wxWave.py b/wxPython/demo/wxWave.py index 1ea3c4998b..b84e62148b 100644 --- a/wxPython/demo/wxWave.py +++ b/wxPython/demo/wxWave.py @@ -1,35 +1,39 @@ +# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o Updated for wx namespace +# + +import wx -from wxPython.wx import * from Main import opj #---------------------------------------------------------------------- -class TestPanel(wxPanel): +class TestPanel(wx.Panel): def __init__(self, parent): - wxPanel.__init__(self, parent, -1) + wx.Panel.__init__(self, parent, -1) - b = wxButton(self, -1, "Play Sound 1", (25, 25)) - EVT_BUTTON(self, b.GetId(), self.OnButton1) + b = wx.Button(self, -1, "Play Sound 1", (25, 25)) + self.Bind(wx.EVT_BUTTON, self.OnButton1, b) - b = wxButton(self, -1, "Play Sound 2", (25, 65)) - EVT_BUTTON(self, b.GetId(), self.OnButton2) + b = wx.Button(self, -1, "Play Sound 2", (25, 65)) + self.Bind(wx.EVT_BUTTON, self.OnButton2, b) def OnButton1(self, evt): try: - wave = wxWave(opj('data/anykey.wav')) + wave = wx.Wave(opj('data/anykey.wav')) wave.Play() except NotImplementedError, v: - wxMessageBox(str(v), "Exception Message") + wx.MessageBox(str(v), "Exception Message") def OnButton2(self, evt): try: - wave = wxWave(opj('data/plan.wav')) + wave = wx.Wave(opj('data/plan.wav')) wave.Play() except NotImplementedError, v: - wxMessageBox(str(v), "Exception Message") - + wx.MessageBox(str(v), "Exception Message") #---------------------------------------------------------------------- @@ -41,10 +45,14 @@ def runTest(frame, nb, log): overview = """\ -""" - +This class represents a short wave file, in Windows WAV format, that can +be stored in memory and played. Currently this class is implemented on Windows +and GTK (Linux) only. +This demo offers two examples, both driven by buttons, but obviously the event +that drives the playing of the sound can come from anywhere. +""" if __name__ == '__main__':