Problems with latest release of wxPython

The following code was taken from a post by Robin Dunn about 1 year
ago (please read my comments added to the script).

`      ## Script taken from:

``

``##�� Original posted by RobinD42� about a year ago``

``#``

``      #�� Modifications by V. Stokes (search on #VS to see my

comments/modifications)``

``#``

``      #�� System/software information (where play works but

display fails)``

``#��� Python:��� vers. 2.7.5 ``

``#��� wxPython:� vers. 3.0.0.0``

``#��� Windows Vista (32-bit)``

``#``

``      #� System/software information (where play works and

display works)``

``#��� Python:��� vers. 2.7.5 ``

``#��� wxPython:� vers. 2.8.12.1``

``#��� Windows 7 (64-bit)``

``

``#��� ``

``import wx``

``import wx.media``

``import os``

``

``      ##VS The following is specific to my system and can be

changed easily`` as needed

``#������������� laptop�������� desktop``

``dirpaths = [r'D:/Videos/', r'C:/Videos/'] ``

``for path in dirpaths:``

``��� if os.path.exists(path):``

``������� defDir = path``

``#VS video = defDir+'julius.avi'``

``#VS video = defDir + 'flyby-divx.avi'``

``

``#----------------------------------------------------------------------``

``

``class StaticText(wx.StaticText):``

``��� """``

``      A StaticText that only updates the label if it has changed,

to``

``help reduce potential flicker since these controls would be``

``updated very frequently otherwise.``

``"""``

``��� def SetLabel(self, label):``

``������� if label <> self.GetLabel():``

``����������� wx.StaticText.SetLabel(self, label)``

``

``#----------------------------------------------------------------------``

``

``class TestPanel(wx.Panel):``

``��� def __init__(self, parent):����� #VS``

``������� #VS self.log = log``

``������� wx.Panel.__init__(self, parent, -1,``

``      �������������������������

style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN)``

``

``������� # Create some controls``

``������� try:``

``����������� backend = ""``

``����������� if 'wxMSW' in wx.PlatformInfo:``

``      ��������������� # the default backend doesn't always send

the EVT_MEDIA_LOADED``

``      ��������������� # event which we depend upon, so use a

different backend by``

``��������������� # default for this demo.``

``��������������� backend = wx.media.MEDIABACKEND_QUICKTIME``

``      ��������������� #backend = wx.media.MEDIABACKEND_WMP10�����

#VS``

``      ��������������� #backend=wx.media.MEDIABACKEND_DIRECTSHOW��

#VS ``

``��������������� ``

``����������� self.mc = wx.media.PreMediaCtrl()``

``      ����������� ok = self.mc.Create(self,

style=wx.SIMPLE_BORDER,``

``������������������������������� szBackend=backend)``

``����������� if not ok:``

``��������������� raise NotImplementedError``

``����������� self.mc.PostCreate(self.mc)``

``������� except NotImplementedError:``

``����������� self.Destroy()``

``����������� raise``

``

``      ������� self.Bind(wx.media.EVT_MEDIA_LOADED,

self.OnMediaLoaded)``

``

``������� btn1 = wx.Button(self, -1, "Load File")``

``������� self.Bind(wx.EVT_BUTTON, self.OnLoadFile, btn1)``

``������� ``

``������� btn2 = wx.Button(self, -1, "Play")``

``������� self.Bind(wx.EVT_BUTTON, self.OnPlay, btn2)``

``������� self.playBtn = btn2``

``������� ``

``������� btn3 = wx.Button(self, -1, "Pause")``

``������� self.Bind(wx.EVT_BUTTON, self.OnPause, btn3)``

``������� ``

``������� btn4 = wx.Button(self, -1, "Stop")``

``������� self.Bind(wx.EVT_BUTTON, self.OnStop, btn4)``

``

``������� slider = wx.Slider(self, -1, 0, 0, 10)``

``������� self.slider = slider``

``������� slider.SetMinSize((150, -1))``

``������� self.Bind(wx.EVT_SLIDER, self.OnSeek, slider)``

``

``������� self.st_size = StaticText(self, -1, size=(100,-1))``

``������� self.st_len = StaticText(self, -1, size=(100,-1))``

``������� self.st_pos = StaticText(self, -1, size=(100,-1))``

``������� ``

``������� # setup the layout``

``������� sizer = wx.GridBagSizer(5,5)``

``      ������� sizer.Add(self.mc, (1,1), span=(5,1))#,

flag=wx.EXPAND)``

``������� sizer.Add(btn1, (1,3))``

``������� sizer.Add(btn2, (2,3))``

``������� sizer.Add(btn3, (3,3))``

``������� sizer.Add(btn4, (4,3))``

``������� sizer.Add(slider, (6,1), flag=wx.EXPAND)``

``������� sizer.Add(self.st_size, (1, 5))``

``������� sizer.Add(self.st_len, (2, 5))``

``������� sizer.Add(self.st_pos, (3, 5))``

``������� self.SetSizer(sizer)``

``

``      �������

#self.DoLoadFile(os.path.abspath(“data/testmovie.mpg”))``

``      ������� #VS wx.CallAfter(self.DoLoadFile,

os.path.abspath(“data/testmovie.mpg”))``

``������� #VS wx.CallAfter(self.DoLoadFile, video)``

``

``������� self.timer = wx.Timer(self)``

``������� self.Bind(wx.EVT_TIMER, self.OnTimer)``

``      ������� self.timer.Start(100)����� # fires event every 100

ms``

``

``��� def OnLoadFile(self, evt):``

``      ������� dlg = wx.FileDialog(self, message="Choose a media

file",``

``      ��������������������������� defaultDir=defDir,

defaultFile="*.avi",��� # VS``

``��������������������������� style=wx.OPEN | wx.CHANGE_DIR )``

``������� if dlg.ShowModal() == wx.ID_OK:``

``����������� path = dlg.GetPath()``

``����������� self.DoLoadFile(path)``

``������� dlg.Destroy()``

``

``

``��� def DoLoadFile(self, path):``

``������� self.playBtn.Disable()``

``������� if not self.mc.Load(path):``

``      ����������� wx.MessageBox("Unable to load %s: Unsupported

format?" % path,``

``������������������������� "ERROR",``

``������������������������� wx.ICON_ERROR | wx.OK)``

``������� else:``

``����������� self.mc.SetInitialSize()``

``����������� self.GetSizer().Layout()``

``����������� self.slider.SetRange(0, self.mc.Length())``

``

``��� def OnMediaLoaded(self, evt):``

``������� self.playBtn.Enable()``

``��� ``

``��� def OnPlay(self, evt):``

``������� if not self.mc.Play():``

``      ����������� wx.MessageBox("Unable to Play media :

Unsupported format?",``

``������������������������� "ERROR",``

``������������������������� wx.ICON_ERROR | wx.OK)``

``������� else:``

``����������� self.mc.SetInitialSize()``

``����������� self.GetSizer().Layout()``

``����������� self.slider.SetRange(0, self.mc.Length())``

``

``��� def OnPause(self, evt):``

``������� self.mc.Pause()``

``��� ``

``��� def OnStop(self, evt):``

``������� self.mc.Stop()``

``

``��� def OnSeek(self, evt):``

``������� """``

``��������� Triggered when user moves slider with mouse``

``      ���������� wx.media.MediaCtrl.Seek(offset) --- moves to

position offset (elapsed time in ms)``

``������� """� ``

``������� offset = self.slider.GetValue()``

``������� self.mc.Seek(offset)``

``

``��� def OnTimer(self, evt):``

``������� """``

``      ��������� wx.media.MediaCtrl.Tell()� --- returns current

position in media (elapsed time in ms)���������� ``

``      ��������� wx.media.MediaCtr.Length() --- returns total time

of media in ms``

``������� """``

``������� offset = self.mc.Tell()``

``������� self.slider.SetValue(offset)``

``      ������� self.st_size.SetLabel('size: %s' %

self.mc.GetBestSize())``

``      ������� self.st_len.SetLabel('length: %d seconds' %

(self.mc.Length()/1000))``

``������� self.st_pos.SetLabel('position: %d' % offset)``

``

``��� def ShutdownDemo(self):``

``������� self.timer.Stop()``

``������� del self.timer``

``

``#***************************************************``

``if __name__ == '__main__':``

``��� app = wx.App(0)������������������������� ``

``��� ``

``��� frame = wx.Frame(None,size=(1000,700))�� ``

``��� panel = TestPanel(frame)��������������� ``

``��� frame.Show()``

``��� ``

``��� app.MainLoop()�������������������������� ``

  I have a set of test AVI videos (all downloaded from the web, e.g.

) — None of these with this code when using wxPython 3.0.0.0! However, I have found
one AVI that executes as expected i.e., displays while being
played (julius.avi at
) with wxPythyon vers.
3.0.0.0. I have put considerable effort in trying to isolate the
problem(s) with the AVIs that do not display, e.g. trying a
different “backend”; but, so far, unsuccessful. I would like very
much to upgrade to wxPython 3.0.0.0, as it seems there have been
many improvements by Robin.
Any help on finding the problem(s) with these AVIs would be
appreciated.
–VS`

···

https://github.com/wxWidgets/wxPython/blob/master/demo/MediaCtrl.pyhttp://thud.us/videos/misc/xvid-samples/displayedhttp://www.mysticfractal.com/video/avi1.html

Those are DivX/XVID/MPEG2 videos. Do you have the DivX codec pack
loaded on your 32-bit Vista system? Windows, as shipped, does not
know how to decode DivX videos.

···

Virgil Stokes wrote:

  The following code was taken from a post by Robin Dunn about 1

year ago (please read my comments added to the script).

  `...``                ``

    I have a set of test AVI videos (all downloaded from the web,

e.g. )
— None of these with this code when using
wxPython 3.0.0.0! `

-- Tim Roberts, Providenza & Boekelheide, Inc.

http://thud.us/videos/misc/xvid-samples/displayedtimr@probo.com

I do not understand your response Tim. All these AVIs did display
when I used the older version of wxPython (2.8.12.1) on both my
Windows Vista and Windows 7 systems; but, after updating to wxPython
3.0.0.0 on my Windows Vista system they did not display!
Perhaps, this was unclear in my earlier email.

···

On 2014-01-06 19:36, Tim Roberts wrote:

  Those are DivX/XVID/MPEG2 videos.  Do you have the DivX codec pack

loaded on your 32-bit Vista system? Windows, as shipped, does not
know how to decode DivX videos.

  -- You received this message because you are subscribed to the Google

Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to .
For more options, visit .

Virgil Stokes wrote:

    The following code was taken from a post by Robin Dunn about 1

year ago (please read my comments added to the script).

    `...``                ``

      I have a set of test AVI videos (all downloaded from the web,

e.g. )
— None of these with this code when using
wxPython 3.0.0.0! `
http://thud.us/videos/misc/xvid-samples/displayed

-- Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com

wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/groups/opt_out