i am trying to build a music player using wxpython, mPlayerCtrl. But i am having a issue n getting the length of the added music. I have tried:
self.mplayer.Length()
when I am using .Length() its giving error
AttributeError: 'MplayerCtrl' object has no attribute 'Length'
self.mplayer.length()
And ehen i am using .length() its giving error
TypeError: 'NoneType' object is not callable
t_len = self.mplayer.GetTimeLength()
self.playbackSlider.SetRange(0, t_len)
This gives an error
TypeError: Slider.SetRange(): argument 2 has unexpected type 'NoneType'
my code is as belows
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
self.currentFolder = os.path.dirname(path[0])
trackPath = '"%s"' % path.replace("\\", "/")
self.mplayer.Loadfile(trackPath)
t_len = self.mplayer.GetTimeLength()
self.playbackSlider.SetRange(0, t_len)
self.playbackTimer.Start(100.0)