X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b2bacf13e35b54b68ba707894630eff0e36da6b1..6c7afb7435d11d7b67d16c51e1302cad5572491e:/wxPython/demo/Sound.py diff --git a/wxPython/demo/Sound.py b/wxPython/demo/Sound.py index 456733b5bf..91508ad5c8 100644 --- a/wxPython/demo/Sound.py +++ b/wxPython/demo/Sound.py @@ -9,7 +9,7 @@ class TestPanel(wx.Panel): def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log - + b = wx.Button(self, -1, "Play Sound 1 (sync)", (25, 25)) self.Bind(wx.EVT_BUTTON, self.OnButton1, b) @@ -32,7 +32,13 @@ class TestPanel(wx.Panel): def OnButton2(self, evt): try: - sound = wx.Sound(opj('data/plan.wav')) + if True: + sound = wx.Sound(opj('data/plan.wav')) + else: + # sounds can also be loaded from a buffer object + data = open(opj('data/plan.wav'), 'rb').read() + sound = wx.SoundFromData(data) + self.log.write("before Play...\n") sound.Play(wx.SOUND_ASYNC) wx.YieldIfNeeded() @@ -53,7 +59,7 @@ class TestPanel(wx.Panel): except NotImplementedError, v: wx.MessageBox(str(v), "Exception Message") dlg.Destroy() - + #---------------------------------------------------------------------- @@ -66,8 +72,8 @@ def runTest(frame, nb, log): overview = """
This demo offers two examples, both driven by buttons, but obviously the event