Package pyzzle :: Module Movie :: Class Movie
[hide private]
[frames] | no frames]

Class Movie

source code

          object --+        
                   |        
pygame.sprite.Sprite --+    
                       |    
             Panel.Panel --+
                           |
                          Movie

Presents video/audio to the user in a manner similar to Slides.

Like the Slide, movies can blit an image to the screen, perform click and highlight behavior, nest within Panels, and even nest Sprites such as Hotspots, Text, and Slides.

It is worth mentioning that Pygame has limited support for movies, and these limitations transfer to Pyzzle. Movie files must use the MPEG-1 video codec. If the movie files contain audio, they must use the MPEG-2 audio codec (not MP2), and no other sounds can play alongside them. As of 0.9, I have not been able to get sound to play from movie files. However, you can specify a seperate audio file to play alongside the movie using the soundfile attribute. This has the added benefit of being able to play alongside other sounds.

Instance Methods [hide private]
 
__init__(self, id, moviefile, soundfile=None, stage=None, rectRel=None, layer=0, loop=False, onStop=lambda: None)
Creates a Movie
source code
 
_load(self) source code
 
_getMovie(self)
The movie that is played.
source code
 
movie(self)
The movie that is played.
source code
 
_getRect(self)
The coordinates of the movie.
source code
 
rect(self)
The coordinates of the movie.
source code
 
draw(self, screen)
Renders the movie to the screen, then draws any sprites within the Movie.
source code
 
enter(self, oldslide=None, delay=.1)
Called when the user encounters the Movie.
source code
 
exit(self, newslide=None, delay=.1)
Called when the user exits the Movie.
source code

Inherited from pygame.sprite.Sprite: __repr__, add_internal, alive, groups, kill, remove_internal, update

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

    Inherited from Panel.Panel
 
__contains__(self, sprite) source code
 
__iter__(self) source code
 
_setRect(self, rect) source code
 
add(self, sprite)
Adds the sprite to the Panel.
source code
 
click(self, **param)
Called when the user clicks the Panel.
source code
 
empty(self)
Empties all nested sprites from the Panel.
source code
string
highlight(self)
Called when the cursor hovers over the Panel.
source code
 
remove(self, sprite)
Removes the sprite from the Panel.
source code
Class Variables [hide private]
    Inherited from Panel.Panel
  cursorDefault = 'default.png'
Instance Variables [hide private]
    Inherited from Panel.Panel
  enabled
Whether draw(), highlight(), and click() functions of the slide should be called by the parent panel.
  onEnter
The function that is called when the player enters the slide.
  onExit
The function that is called when the player exits the slide.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, id, moviefile, soundfile=None, stage=None, rectRel=None, layer=0, loop=False, onStop=lambda: None)
(Constructor)

source code 

Creates a Movie

Parameters:
  • id - A unique identifier for the Movie.
  • moviefile - The name of the movie file to be played
  • soundfile - The name of the sound file to be played in sync with the movie. Use this parameter if you cannot get sound to work from your movie file, or if you would like other sounds to play along with the movie (ambience, music, effects, etc.)
  • stage (Stage) - An area of the game in which the movie occurs. Used to determine folder paths.
  • rectRel (RelativeRect) - The rectangle occupied by the Movie. rect width and height do not resize the movie - this is a limitation within Pygame.
  • layer (float) - The layer of the Movie. Larger numbers represent upper layers. Upper layers will draw over lower layers.
  • loop - Whether the movie should loop endlessly.
  • onStop - The function that plays upon completion of the movie. If loop=True, this function will never fire.
  • boolean ()
Overrides: object.__init__

_getRect(self)

source code 

The coordinates of the movie. rect coordinates are determined by rectRel. If a coordinate in rectRel is None, the coordinate is determined by the slide's image size.

Overrides: Panel.Panel._getRect

rect(self)

source code 

The coordinates of the movie. rect coordinates are determined by rectRel. If a coordinate in rectRel is None, the coordinate is determined by the slide's image size.

Overrides: rect

draw(self, screen)

source code 

Renders the movie to the screen, then draws any sprites within the Movie.

Parameters:
  • screen - The surface to draw on.
Overrides: Panel.Panel.draw

enter(self, oldslide=None, delay=.1)

source code 

Called when the user encounters the Movie.

Parameters:
  • oldslide (Panel) - The Panel that was previously presented to the user, to be replaced by self
  • delay - The time it should take for oldslide to transition to self
Overrides: Panel.Panel.enter

exit(self, newslide=None, delay=.1)

source code 

Called when the user exits the Movie.

Parameters:
  • newslide (Panel) - The Panel that was previously presented to the user, to be replaced by self
  • delay - The time it should take for oldslide to transition to self, in seconds
Overrides: Panel.Panel.exit