I want to wait the song to finish after it finishes, I want to call another function
How do I do that in wxpython

After Long time searching I found nothig as such.
Then I tried to catch EVT_MEDIA_FINISHED by bind as shown belo

self.Bind(wx.media.EVT_MEDIA_FINISHED, self.onFinished_playing)

And the function below for modifying filename and call play

def onCheck_loop(self, path): #Loads file and calls play function
        self.path = path.strip()            
        if not self.player.Load(path):
            wx.MessageBox("Unable to Play this file, it is in the wrong format")
        else:
            self.SetTitle("Now Playing %s" %(self.path,))
            time.sleep(10)
            self.onPlay(wx.media.EVT_MEDIA_LOADED)
      
    def onFinished_playing(self, evt): 
            print "Finished, starting next track"
            time.sleep(10)
            self.onSetPath_loop()       #detects finished song and calls another function to Load file     
    #play it
    def onPlay(self, evt):  
        self.player.Play()              
        self.slider.SetRange(0, self.player.Length())
        self.player.SetVolume(0.404459081855)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.