[vlc-devel] [PATCH] Fixed PyQt example for MacOS X platform.

Hendrik Buschmeier hbuschme at uni-bielefeld.de
Thu Oct 17 09:48:31 CEST 2013


* Draws the video onto the QWidget instead of only showing a
  a black box.
* Uses QMacCocoaViewContainer instead of QFrame as videoframe
  QWidget.
* Uses MediaPlayer's set_nsobject method instead of set_agl.
* Fixes spelling error in QWidget method being called.
---
 examples/qtvlc.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/examples/qtvlc.py b/examples/qtvlc.py
index 34aeedc..2d427e7 100755
--- a/examples/qtvlc.py
+++ b/examples/qtvlc.py
@@ -46,7 +46,10 @@ class Player(QtGui.QMainWindow):
         self.setCentralWidget(self.widget)
 
         # In this widget, the video will be drawn
-        self.videoframe = QtGui.QFrame()
+        if sys.platform == "darwin": # for MacOS
+            self.videoframe = QtGui.QMacCocoaViewContainer(0)
+        else:
+            self.videoframe = QtGui.QFrame()
         self.palette = self.videoframe.palette()
         self.palette.setColor (QtGui.QPalette.Window,
                                QtGui.QColor(0,0,0))
@@ -152,7 +155,7 @@ class Player(QtGui.QMainWindow):
         elif sys.platform == "win32": # for Windows
             self.mediaplayer.set_hwnd(self.videoframe.winId())
         elif sys.platform == "darwin": # for MacOS
-            self.mediaplayer.set_agl(self.videoframe.windId())
+            self.mediaplayer.set_nsobject(self.videoframe.winId())
         self.PlayPause()
 
     def setVolume(self, Volume):
-- 
1.8.4




More information about the vlc-devel mailing list