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

Re: [pygame] movie playing



Peter Shinners wrote:

On Mon, 2006-04-24 at 14:54 +0300, İzzet Aykut KOÇAK wrote:


I am trying to play short movies with pygame but below codes hangs and can not be terminated with ctrl-c and has to be killed. Any suggestions?

import pygame,time

if __name__=='__main__':
ret=pygame.init()
print ret
d=pygame.display.set_mode((640,480))
m=pygame.movie.Movie('test.mpg')
m.set_display(d)
m.play()
while m.get_busy():
print time.time()
time.sleep(1)
pygame.quit()



What platform are you running this on? On a unix type system ctrl-c is good at stopping pygame.

You definitely want to add a pygame.event.pump() call to your inner
loop. You could also at least test for a QUIT event. That will allow
closing the display window to stop the program.

   while m.get_busy():
       print time.time()
       time.sleep(1)
       for e in pygame.event.get():
           if e.type == pygame.QUIT:
               import sys
               sys.exit()





my platform is debian running on linux-kernel-2.6.12 and fbdev. All software is installed through debian packages. I am using vga=785 and video=vesa:ypan,mtrr parameters during boot.

I have tried above code, but nothing changed. Actually I have added a print line just after movie creation which has never been worked. It hangs on line "m=pygame.movie.Movie('test.mpg')"

Any further suggestion?

Thnx

Aykut