Code for playing video in wx.Media after the wmv file is loaded
<p>I am a newbie in wxPython and I have to write a code that can immediately start playing a video after I load the file. I have been going through a lot of forums tried to implement 10 - 20 codes, but the wx.media is not playing the video file at all. I am able to load the file but not play it.</p>

<p>I need a simple code in which I will manually enter the path name of the video file and after this file is loaded it should start playing.</p>

<p>I am using windows XP, Python 2.7 and wxPython for Python 2.7.</p>

<p>I would be very grateful to all of you if you could help me on this one.</p>

<p>Following is the code that I am using to <strong>load()</strong> and then <strong>play()</strong> the file. Still it is not working.</p>

<pre><code>import wx 
import wx.media

class TestPanel(wx.Panel):

    def __init__(self, parent):

        wx.Panel.__init__(self, parent, -1, style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN)

        # Create some controls
        try:
            self.mc = wx.media.MediaCtrl(self, style=wx.SIMPLE_BORDER)
        except NotImplementedError:
            self.Destroy()
            raise
        self.mc.Load(r"C:\Documents and Settings\N1002401B\Desktop\test1.wmv")
        #self.slider.SetRange(0, self.mc.Length())
        #folder, filename = os.path.split("C:\Documents and Settings\N1002401B\Desktop\test1.wmv")
        self.Bind(wx.media.EVT_MEDIA_LOADED, self.OnPlay)
    def OnPlay(self,evt):
        self.mc.Play()

app = wx.App(0)

frame = wx.Frame(None)
panel = TestPanel(frame)
frame.Show()

app.MainLoop()
</code></pre>

<p>Thanking you.</p>
