473,238 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

Using wxMediaCtrl in wxPython

2
Hi There
I will like to play back an mpeg video file using wxPython's MediaCtrl class. The video controls are grayed out and the file doesnt play.

Any suggestions would be welcome
Heres a sample of the code

Thanks
Chaven
Expand|Select|Wrap|Line Numbers
  1. #==================================================
  2. import wx 
  3. import wx.media
  4.  
  5. class MyFrame(wx.Frame): 
  6.     def __init__(self,parent,title): 
  7.         wx.Frame.__init__(self,parent,-1,title,pos=(150,150),size =(640, 480),style=wx.MAXIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX|wx.CLIP_CHILDREN)
  8.         self.Bind(wx.EVT_CLOSE,self.OnCloseWindow)
  9.         panel = wx.Panel(self,size=(350,200)) 
  10.          video = wx.media.MediaCtrl(panel,-1,fileName ="V003.mpg",pos=wx.Point(100,50),size=wx.Size(320,240))
  11.  
  12.         video.ShowPlayerControls(flags = wx.media.MEDIACTRLPLAYERCONTROLS_STEP)                
  13.         video.Play()
  14.  
  15.     def OnCloseWindow(self,event): 
  16.         self.Destroy() 
  17. class MyApp(wx.App): 
  18.     def OnInit(self): 
  19.         frame = MyFrame(None,'Form1') 
  20.         frame.Show(True) 
  21.         return True 
  22. app=MyApp(redirect=True) 
  23. app.MainLoop()
Aug 23 '07 #1
3 6548
bartonc
6,596 Expert 4TB
You probably lack the codec or it is not being found. Have you tried just playing a native format (.wmv on Windows, etc)?
Aug 23 '07 #2
bartonc
6,596 Expert 4TB
You probably lack the codec or it is not being found. Have you tried just playing a native format (.wmv on Windows, etc)?
Another possibility is that the file is not being found. Is the moving in the same directory as you wxPython app?
Aug 23 '07 #3
bartonc
6,596 Expert 4TB
This works on my system:
Expand|Select|Wrap|Line Numbers
  1. import wx 
  2. import wx.media
  3.  
  4. class MyFrame(wx.Frame): 
  5.     def __init__(self,parent,title): 
  6.         wx.Frame.__init__(self, parent, -1, title, pos=(150,150), size=(640, 480),
  7.                           style=wx.MAXIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX|wx.CLIP_CHILDREN)
  8.         self.Bind(wx.EVT_CLOSE,self.OnCloseWindow)
  9.         panel = wx.Panel(self,size=(350,200)) 
  10.         video = wx.media.MediaCtrl(panel, -1, fileName=r"D:\My Documents\My Videos\Who_Let_The_Dogs_Out.wmv",
  11.                                    pos=wx.Point(100,50),size=wx.Size(320,240))
  12.  
  13.         video.ShowPlayerControls(flags = wx.media.MEDIACTRLPLAYERCONTROLS_STEP)                
  14.         video.Play()
  15.  
  16.     def OnCloseWindow(self,event): 
  17.         self.Destroy()
  18.  
  19. class MyApp(wx.App): 
  20.     def OnInit(self): 
  21.         frame = MyFrame(None,'Form1') 
  22.         frame.Show(True) 
  23.         return True 
  24. app=MyApp(redirect=True) 
  25. app.MainLoop()
Aug 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Equis Uno | last post by:
Hi, I'm trying to run some Python software I downloaded off of sf.net. It's called Boa. It uses wxPython. It appears my install of Python cannot see my install of wxPython.
2
by: Axium Computer Services | last post by:
I just recently started trying to teach myself python and wxPython. The python portion of that hasn't been much of a problem as documentation seems available and of good quality. While I was...
15
by: Grant Edwards | last post by:
Can anybody recommend a good book on wxPython? Are there any books on wxPython? I've been trying to learn wxPython and/or wax for a few weeks, and I'm just not getting it. wxWindows seems...
1
by: James Stroud | last post by:
Hello All, I will soon have an excuse to install a new operating system on my computer. I would like to know exactly what operating system I should have so that I can get wxPython going....
3
by: Kenneth McDonald | last post by:
If this is not an appropriate newsgroup for this type of posting, please let me know and (if possible) suggest an alternative. I've done a fair bit of research on the net, but information is...
8
by: John Salerno | last post by:
Hi all. Quick question (but aren't they all?) :) Do you think it's a good idea to use the 'from <name> import *' statement when using a GUI module? It seems on wxPython's site, they recommend...
2
by: Marco | last post by:
Hi, I have a problem to install wxPython on my MacBook (Pythonversion 2.5). If would install the wxPython (python setup.py install), then I got this error: Traceback (most recent call last):...
4
by: stef | last post by:
hello, I'm trying to move from Delphi to Python (move from MatLab to Python already succeeded, also thanks to this discussion group). From the discussions in this list about "the best" GUI for...
1
by: Marcin Kalicinski | last post by:
I have an application written in C++ that uses wxWidgets for GUI. I use embedded Python for scripting inside of this application. I want to use wxPython to add GUI to my scripts - because my C++...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.