]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/Sound.py
Don't decref if the interpreter is not initialized, (eg. it's in its
[wxWidgets.git] / wxPython / demo / Sound.py
index 91508ad5c851b8c905771cabda3ba1b34ed7fd73..2584de414c0676163fc2027f728a8019959d3533 100644 (file)
@@ -41,6 +41,7 @@ class TestPanel(wx.Panel):
                 
             self.log.write("before Play...\n")
             sound.Play(wx.SOUND_ASYNC)
                 
             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:
             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:
                             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()
             except NotImplementedError, v:
                 wx.MessageBox(str(v), "Exception Message")
         dlg.Destroy()