Python Threading, loading one thread after another

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-06-14T12:23:38Z Indexed on 2010/06/14 13:12 UTC
Read the original article Hit count: 183

Filed under:
|
|
|

Hi,

I'm working on a media player and am able to load in a single .wav and play it. As seen in the code below.

  foo = wx.FileDialog(self, message="Open a .wav file...", defaultDir=os.getcwd(), defaultFile="", style=wx.FD_MULTIPLE)
  foo.ShowModal()

  queue = foo.GetPaths()

  self.playing_thread = threading.Thread(target=self.playFile, args=(queue[0], 'msg'))
  self.playing_thread.start()

But the problem is, when I try to make the above code into a loop for multiple .wav files. Such that while playing_thread.isActive == True, create and .start() the thread. Then if .isActive == False, pop queue[0] and load the next .wav file. Problem is, my UI will lock up and I'll have to terminate the program. Any ideas would be appreciated.

© Stack Overflow or respective owner

Related posts about python

Related posts about threading