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

Re: [pygame] problem - movie in pygame



The movie module was changed, and there is no loop argument currently. The docs were not update for this.

On Sat, Aug 8, 2009 at 9:41 AM, Wayne Dyck <wayne@xxxxxxxxxxxxxx> wrote:
A question that has me a little stumped. In a list e-mail from 2008,
bhaaluu submitted the following code to play simple movies with pygame,

=============================
I run a Debian GNU/Linux system, Python 2.4.4 and PyGame 1.7.

I use this script to play movies. Maybe you can modify it for your game?

#!/usr/bin/python
"""Usage: python playMovie.py movie.mpg
  'q' = Quit
"""
import pygame
from pygame.locals import *

def main(filepath):
 pygame.init()
 pygame.mixer.quit()
 movie = pygame.movie.Movie(filepath)
 screen = pygame.display.set_mode(movie.get_size())
 movie.set_display(screen)

 pygame.event.set_allowed((QUIT, KEYDOWN))
 movie.play()
 while movie.get_busy():
     evt = pygame.event.wait()
     if evt.type == QUIT:
         break
     if evt.type == KEYDOWN and evt.unicode == u'q':
         break
 if movie.get_busy():
     movie.stop()

if __name__ == '__main__':
 import sys
 main(sys.argv[1])
=============================

It works fine under Python 2.6 and pygame 1.8.1 and pygame 1.9.1,
however, if I change the "movie.play()" line to include an argument like
the docs say you should be able to, e.g. movie.play(1) I get the
following error message,

TypeError: play() takes no arguments (1 given)

My question is why?

Under pygame 1.7 this used to work. Has the underlying code changed and
the docs didn't keep up with it?

Thanks for any suggestions.

Wayne



--
Visit my blog at http://oddco.ca/zeroth/zblog