On Mar 21, 5:38 pm, Charles Brandt <[email protected]> wrote:
> Hello,
>
> I have a python script (see below) that uses PyObjC to play a movie
> using the Quicktime framework.
>
> I was hoping to adapt this to a pyglet context, but when I replace the
> window used in the script with:
> window = pyglet.window.Window(width=200, height=200)
>
> I get:
>    File "test-qt-video.py", line 59, in <module>
>      view.setMovie_(movie)
> objc.error: NSInternalInconsistencyException - CGSDisableUpdate returned
> error 1002d
>
> I am using the pyglet cocoa branch.
>
> Does anyone have any ideas or experience integrating external video
> decoders with a pyglet window?

I get that error when I try to run with the carbon
implementation.  Are you certain that the cocoa
implementation is being used? The cocoa branch
(which has now been merged) will default to carbon
unless you're running in a 64-bit python.

The code below should work.  The class returned by
pyglet.window.Window is not a subclass of NSWindow.
The NSWindow instance that it wraps can be accessed
through the _nswindow attribute.  Note though that
if you change the contentView of the pyglet window
as below, you lose all of the pyglet event handling
since that is handled by a special subclass of
NSView that pyglet uses.  So I'm not sure if this is
really what you were looking for.

--phillip

###############################################

import pyglet

pyglet.options['darwin_cocoa'] = True

from QTKit import QTMovie, QTMovieView
import sys

window = pyglet.window.Window()

filename = "/System/Library/Compositions/Sunset.mov"
movie, error = QTMovie.movieWithFile_error_(filename, None)
if error or not movie:
     print "Problem with movie", filename, ":", error.description()
     sys.exit(0)
print movie.duration
view = QTMovieView.alloc().init()

view.setMovie_(movie)
view.setControllerVisible_(False)
view.setPreservesAspectRatio_(True)

window._nswindow.setContentView_(view)

view.play_(window._nswindow)
pyglet.app.run()

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to