1 """MovieInWindow converted to python
3 Jack Jansen, CWI, December 1995
19 # skip the toolbox initializations, already done
20 # XXXX Should use gestalt here to check for quicktime version
24 fss
, ok
= macfs
.StandardGetFile() # Was: QuickTime.MovieFileType
29 bounds
= (175, 75, 175+160, 75+120)
30 theWindow
= Win
.NewCWindow(bounds
, fss
.as_tuple()[2], 1, 0, -1, 0, 0)
32 # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
34 playMovieInWindow(theWindow
, fss
, theWindow
.GetWindowPort().portRect
)
36 def playMovieInWindow(theWindow
, theFile
, movieBox
):
37 """Play a movie in a window"""
38 # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil);
41 theMovie
= loadMovie(theFile
)
43 # Set where we want it
44 theMovie
.SetMovieBox(movieBox
)
46 # Start at the beginning
47 theMovie
.GoToBeginningOfMovie()
49 # Give a little time to preroll
50 theMovie
.MoviesTask(0)
55 while not theMovie
.IsMovieDone() and not Evt
.Button():
56 theMovie
.MoviesTask(0)
58 def loadMovie(theFile
):
59 """Load a movie given an fsspec. Return the movie object"""
60 movieResRef
= Qt
.OpenMovieFile(theFile
, 1)
61 movie
, d1
, d2
= Qt
.NewMovieFromFile(movieResRef
, 0, QuickTime
.newMovieActive
)
64 if __name__
== '__main__':