First of all let me thank Timo, Lie Ryan, and Ramit, for their
constructive answers to my pygame/livewires blinking text question.

I wasn't able to use any of their suggestions, but I finally figured
out a method to get blinking text in a simple pygame program.

What I realized was that since it let's you put a background image on
the screen, then all I had to do was create another background image
with the text I wanted to blink on it, then simply use an animation
object to quickly cycle the images, and there you go, blinking text.

I'm sure there's a way to do this that's better, but all I'm trying to
do here is display a blinking "Thank You!" message at the end of my
Python presentation, using this little trick as a way to show the
beginnings of game programming. I'm not trying to write an actual
game, just using this to show a little bit of pygame as an example of
the different things you can do in Python.

Here's what I wound up with:

# thank_you.py
# Demonstrates creating an animation

from livewires import games

games.init(screen_width = 640, screen_height = 480, fps = 50)

screen_image = games.load_image("AEMUG640x480.JPG", transparent = 0)
games.screen.background = screen_image

screen_file = ["AEMUG640x480TY.JPG",
               "AEMUG640x480.JPG"]

screen_refresh = games.Animation(images = screen_file,
                            x = games.screen.width/2,
                            y = games.screen.height/2,
                            n_repeats = 0,
                            repeat_interval = 50)

games.screen.add(screen_refresh)

games.screen.mainloop()


-- 
Frank L. "Cranky Frankie" Palmeri
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to