I'm working on a small script in Python 2.7.9 and Pygame that would be a small display for our IT department. The idea is that there are several toggle switches that indicate our current status (in, out, etc) , some information about our program at the school, and play a short video that repeats with images of the IT staff etc. I have an older version of Pygame compiled that still allows for pygame.movie to function.
All of the parts of the script work, but when it gets to the end of the .mpg, the movie will not replay until there is an EVENT, like switching our status or moving the mouse. I have tried to define a variable with movie.get_time and call to rewind at a certain time, but the movie will not rewind (currently commented out) . Is there a way to play the movie on repeat without requiring an event, or maybe I could spoof an event after a certain length of time (note that the documentation for pygame.movie is outdated, the loops function does not work) ?
Thank you for the help!
import pygame, sys, os, time, random from pygame.locals import * pygame.init() windowSurface = pygame.display.set_mode((0,0), pygame.FULLSCREEN) pygame.display.set_caption("DA IT Welcome Sign") pygame.font.get_default_font() bg = pygame.image.load('da.jpg') in_img = pygame.image.load('in.png') out_img = pygame.image.load('out.png') etc_img = pygame.image.load('etc.png') present = in_img done = False img = 1 clock = pygame.time.Clock() movie = pygame.movie.Movie('wallace.mpg') movie_screen = pygame.Surface(movie.get_size()).convert() playing = movie.get_busy() movie.set_display(movie_screen) length = movie.get_length() currenttime = movie.get_time() movie.play() while not done: for event in pygame.event.get(): if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: done = True if event.type == pygame.QUIT: movie.stop() done = True if event.type == pygame.KEYDOWN and event.key == pygame.K_1: img = 1 if event.type == pygame.KEYDOWN and event.key == pygame.K_2: img = 2 if event.type == pygame.KEYDOWN and event.key == pygame.K_3: img = 3 if event.type == pygame.KEYDOWN and event.key == K_w: pygame.display.set_mode((800, 600)) if event.type == pygame.KEYDOWN and event.key == K_f: pygame.display.set_mode((0, 0), pygame.FULLSCREEN) if img == 1: present = in_img if img == 2: present = out_img if img == 3: present = etc_img if not(movie.get_busy()): movie.rewind() movie.play() #movie.get_time() #if currenttime == 25.0: # movie.stop() # movie.rewind() # movie.play() windowSurface.blit(bg, (0, 0)) windowSurface.blit(movie_screen,(550,175)) windowSurface.blit(present, (0,0)) pygame.display.flip()