X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9318d9b32d9c954353a27eab526a6d0dac25eac3..6a52ea5cb81dcd07c286d34b80945534780fe05f:/wxPython/demo/Sound.py?ds=sidebyside diff --git a/wxPython/demo/Sound.py b/wxPython/demo/Sound.py index 91508ad5c8..2584de414c 100644 --- a/wxPython/demo/Sound.py +++ b/wxPython/demo/Sound.py @@ -41,6 +41,7 @@ class TestPanel(wx.Panel): self.log.write("before Play...\n") sound.Play(wx.SOUND_ASYNC) + self.sound = sound # save a reference (This shoudln't be needed, but there seems to be a bug...) wx.YieldIfNeeded() self.log.write("...after Play\n") except NotImplementedError, v: @@ -54,8 +55,12 @@ class TestPanel(wx.Panel): style=wx.OPEN) if dlg.ShowModal() == wx.ID_OK: try: - sound = wx.Sound(dlg.GetPath()) - sound.Play() + #sound = wx.Sound(dlg.GetPath(), wx.SOUND_SYNC) + #sound.Play() + + # another way to do it. + wx.Sound.PlaySound(dlg.GetPath(), wx.SOUND_SYNC) + except NotImplementedError, v: wx.MessageBox(str(v), "Exception Message") dlg.Destroy()