[Tutor] hey, a bit of a noob at python ut a question about animation...

Kent Johnson kent37 at tds.net
Sun Apr 13 15:53:11 CEST 2008


John Jojo wrote:
> I am trying to make a simple animation, and this is what I have.
>  
> from livewires import games, color

Please say which version of livewires you are using, the one from the 
livewires site is different from the one that comes with Dawson's book.

> games.init(screen_width = 1000, screen_height = 1000, fps = 50)
>     def animate2(self):
>         act = games.Animation(images = Animation.files2,
>                               x = 500,
>                               y = 500,
>                               dy = 1,
>                               lifetime = 5 * games.screen.fps,
>                               repeat_interval = 5,
>                               after_death = games.screen.quit)

You don't seem to do anything with this method - it is never called.

> def main():
>     wall_image = games.load_image("class.jpg", transparent = False)
>     games.screen.background = wall_image
>     animater = Animation()
>     games.screen.add(animater)
>    
>     games.screen.mainloop()
> main()
> I use the after_death item because it is used for the games.Message() 
> command and I thought it would do the same thing here.  It doesn't. 

No, Animation and Message are different objects with different 
interfaces. You have to look at the __init__() method of the Animation 
class to see what parameters it supports.

I don't think Animation supports calling a function when it finishes, 
you will have to find another way to stop the game.

Kent


More information about the Tutor mailing list