normally people just blit one surface to another with the "blit" method of
the dest surface:
http://www.pygame.org/docs/ref/surface.html#Surface.blit
so instead of this:
frame = pygame.surfarray.array2d(screen2) #copies
pygame.surfarray.blit_array(screen, frame)
you could do this:
screen.blit(screen2, (0,0))
...but if you are getting the "frame" array anyways for another purpose,
then the blit_array call is a perfectly fine way to go - it shouldn't
perform any different in your case (i.e. not using hardware display
suraces), and it means you are actually rendering what you are working with,
which can be a good thing.
On Tue, May 26, 2009 at 4:02 PM, Vero E. Arriola
<[email protected]>wrote:
> Hey! I got a way to make it work. Is this the way surfaces are supposed to
> be used??? Thanks ;)
>
> import pygame, sys
> from pygame.locals import *
>
> filepath = "esponja.mpg"
> pygame.init()
> pygame.mixer.quit()
> pygame.surfarray.use_arraytype("numpy")
>
> movie = pygame.movie.Movie(filepath)
> size = w, h = movie.get_size()
> screen = pygame.display.set_mode(size)
> screen2 = pygame.Surface(size)
> movie.set_display(screen2, Rect((0, 0), size))
>
> def play():
> i = 0
> frame_number = 0
> while(1):
> frame_number = movie.render_frame(i)
> frame = pygame.surfarray.array2d(screen2) #copies
> print frame
> pygame.surfarray.blit_array(screen, frame)
> pygame.display.flip()
>
> if frame_number < i:
> break
> i = i + 1
> movie.rewind()
>
>