multithreading - MP3 Playing modules that will run within a thread Python -


i'm trying write program play mp3's. program have gui. in order allow both happen simultaneously i'm implementing threading. however, i've run problem. whenever run program executes normally, except no sound comes out. no errors nothing. it's if command skipped. through process of elimination believe i've found problem caused when run music playing portion of program within thread (self.mp.controls.play()).

is familiar other modules allow me play music within thread? or aware of may causing problem?

code:

import guithread guit # guithread interface made threading module, act if threading.   win32com.client import dispatch  class test :     def __init__ (self) :         self.dir = r'song.mp3'         self.thread = guit.thread(self, func=self.play_song, loop=false)         self.mp = dispatch('wmplayer.ocx')         song = self.mp.newmedia(self.dir)         self.mp.currentplaylist.appenditem(song)      def start (self) :         # starts thread.          # equivalent :         # t = threading.thread(target=self.play_song)         # t.start()         self.thread.start()      def play_song (self) :         # whole function done within thread.          if self.dir != none :             print self.dir              self.mp.controls.play()       def protocol (self, val0, val1) :         # ignore it's unrelated         pass  t = test() t.start() 

this in windows 7, btw.

edit: also, i'm going using tkinter gui toolkit.

you try pymedia or pyglet. know pygame has mp3 support well.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -