[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE: [pygame] Question about playing mpeg video



Hi Pete,

Still no joy - the program still opens a new window to play the
movie...could this have something to do with the fact that I'm running in
windowed mode?

-----Original Message-----
From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx] On
Behalf Of Peter Shinners
Sent: Tuesday, October 18, 2005 12:10 PM
To: pygame-users@xxxxxxxx
Subject: RE: [pygame] Question about playing mpeg video

On Tue, 2005-10-18 at 09:04 -0500, Garry M. Gaber wrote:
> The code I have written so far looks like this:
> 
> self.bMovie = pygame.movie.Movie("./Art/test.mpeg")
> screen_size = (800, 600)
> screen = pygame.display.set_mode (screen_size)
> self.bMovie.set_display(screen)
> self.bMovie.play()
> while self.bMovie.get_busy():
>      time.sleep(0.1)
> 
> I am not sure how to add the code to make this blit to the offscreen
> surface...

self.bMovie = pygame.movie.Movie("./Art/test.mpeg")
screen_size = (800, 600)
screen = pygame.display.set_mode (screen_size)

offscreen = pygame.Surface(self.bMovie.get_size())
self.bMovie.set_display(offscreen)
center = offscreen.get_rect()
center.center = screen.get_rect().center

self.bMovie.play()
while self.bMovie.get_busy():
     screen.blit(offscreen, center)
     time.sleep(0.1)